How to format code for a post

How do I got about formating code I include in a post?

I have taken a look a brief tutorial which depicts a c3 and vb button , but for the file of me I can not located these buttons anywhere

Please help , I dont want to torture other users with unformated code!

[266 byte] By [Mule] at [2007-12-22]
# 1
I was recommended to cut and paste the code from visual studio into word and then copy and paste it into the message box of the forum. This will keep most of the formatting.
AndreasJohansson at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 2
If you copy the code paste it in notepad. Copy the text from note pad and paste it in your post it will keep the formatting of your code.

I made a simple addin with developers express free dxcore which adds a copy as text in the context menu when you right click in the code editor. You can see my blog entry on how to create one yourself.

KenTucker at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 3
Thanks Ken for the prompt response , but from what I understand there are buttons in a toolbar (which I can not find) when posting a new thread that will create a grey block around the code highlighted.
If I copy into notepad and paste this is what I end up with:

Private Sub ucboToWarehouse_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles ucboToWarehouse.Validated
InvHeadBs.AddNew()
Dim row As Data.DataRowView
row = TryCast(InvHeadBs.Current, Data.DataRowView)
row.Row("amIToWarehouseID") = Me.ucboToWarehouse.SelectedValue
End Sub

Not Pretty!
The problem is that when i create a new thread I simply can not highlight and mark as vb code,
I promise I am not blind , I have tried using IE and Firefox , I swear the buttons are not there!

Mule at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 4

You can use markup like [code language="vb"], the code and closed by [/code]



Private Sub ucboToWarehouse_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles ucboToWarehouse.Validated
InvHeadBs.AddNew()
Dim row As Data.DataRowView
row = TryCast(InvHeadBs.Current, Data.DataRowView)
row.Row("amIToWarehouseID") = Me.ucboToWarehouse.SelectedValue
End Sub

AndreasJohansson at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 5
Thank You Andreas that did the trick!!
Mule at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 6
Andreas,

I have also found a tool that will copy source code from vs 2005 as html ,
http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/

CopySourceAsHtml (CSAH)

It seems that this tool will also allow you to create the light grey table around the code and preserve the formatting

Mule at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 7

Mule,

cool! Thanks for sharing it.

So far I have mostly not been using VS2005 but its express edition. They do not support add-ins but for those that use the full version it will be helpful.

If it helps other to post more readable samples it is helping all that want to help. Great!

Thanks again!

AndreasJohansson at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 8
Andreas Johansson wrote:

You can use markup like [code language="vb"], the code and closed by [/code]

Is that a literal markup or an html mode markup? Does one specify the blocks in the editor, paste the code and upon posting it is shown pretty?

Also what would one use for C#? (C# or CSHARP)?

Thanks!

OmegaMan at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...
# 9
the markup works in the editor, it is not for html mode.
AndreasJohansson at 2007-8-30 > top of Msdn Tech,Feedback for forums and MSDN websites,Bug Reports for Forums website...