61

Possible Duplicate:
commenting VB code

Does anybody know how to do a block comment in Visual Basic?

Note: I did a few searches on here and neither those results nor the results for 'Questions that may already have your answer' appeared to ask this question

Community
  • 1
  • 1
Paul C
  • 4,687
  • 5
  • 39
  • 55

4 Answers4

106

There is no block comment in VB.NET.

You need to use a ' in front of every line you want to comment out.

In Visual Studio you can use the keyboard shortcuts that will comment/uncomment the selected lines for you:

Ctrl + K, C to comment

Ctrl + K, U to uncomment

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • 16
    Just to clarify for future readers (fellow beginners) this isn't a three key combo (like Ctrl+Alt+Del) but rather Ctrl+k, Ctrl+c - without releasing ctrl. – Martin KS Aug 17 '17 at 14:59
10

There's not a way as of 11/2012, HOWEVER

Highlight Text (In visual Studio.net)

ctrl + k + c, ctrl + k + u

Will comment / uncomment, respectively

Jon
  • 1,055
  • 13
  • 24
6

Not in VB.NET, you have to select all lines at then Edit, Advanced, Comment Selection menu, or a keyboard shortcut for that menu.

http://bytes.com/topic/visual-basic-net/answers/376760-how-block-comment

http://forums.asp.net/t/1011404.aspx/1

Matthew Layton
  • 39,871
  • 52
  • 185
  • 313
5

In Visual Studio .NET you can do Ctrl + K then C to comment, Crtl + K then U to uncomment a block.

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321