By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

Multi-line comments

P: n/a
cj
Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */

It's something I'd like to have.

I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U
to comment or uncomment selected lines of text in VB but it doesn't work
for me. If anyone knows how let me know.
Apr 20 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
> I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U
to comment or uncomment selected lines of text in VB but it doesn't work
for me. If anyone knows how let me know.


Yes. This is under Edit - Advanced menu and it's called "Comment
Selection" and "Uncomment Selection". Your shortcuts are correct. You
can change them in options. Look for "Edit.CommentSelection" and
"Edit.UncommentSelection" commands. Or you can add them to toolbar using
Customize. You can even add them to context menu like me, see
http://www.vbdocman.com/blog/archives/16 .

--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code
Apr 20 '06 #2

P: n/a
> Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */
It's something I'd like to have.

I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K,
Ctrl+U to comment or uncomment selected lines of text in VB but it
doesn't work for me. If anyone knows how let me know.


No, since the line break is the end of command identifier (as opposed to
the ; in C#, vb does not have continuation for the comments like C#. The
control command combinations might work if you use the C# keyboard settings
in VB. As an alternative, there are a couple toolstrip items in the Text
Editor toolbar which will comment and un comment a block of text by adding
the comment symbols at the beginning of each line.

Jim Wooley
http://devauthority.com/blogs/jwooley
Apr 20 '06 #3

P: n/a

Peter Macej wrote:
I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U
to comment or uncomment selected lines of text in VB but it doesn't work
for me. If anyone knows how let me know.


Yes. This is under Edit - Advanced menu and it's called "Comment
Selection" and "Uncomment Selection". Your shortcuts are correct. You
can change them in options. Look for "Edit.CommentSelection" and
"Edit.UncommentSelection" commands. Or you can add them to toolbar using
Customize. You can even add them to context menu like me, see
http://www.vbdocman.com/blog/archives/16 .


Personally, I map them to Ctrl+' and Ctrl+Shift+', because I already
have a mental connection between ' and commenting.

--
Larry Lard
Replies to group please

Apr 20 '06 #4

P: n/a
cj
So the control command combinations don't work in the VB settings? They
don't work for me. Ctrl+K if pressed twice puts a blue block to the
left of the line. I have no idea what it means. Ctrl+K twice again
removes it. Ctrl+C doesn't do anything--that I can tell.

I just found the buttons on the menu.

Also I'm using VS2003.

Jim Wooley wrote:
Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */
It's something I'd like to have.

I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K,
Ctrl+U to comment or uncomment selected lines of text in VB but it
doesn't work for me. If anyone knows how let me know.


No, since the line break is the end of command identifier (as opposed to
the ; in C#, vb does not have continuation for the comments like C#. The
control command combinations might work if you use the C# keyboard
settings in VB. As an alternative, there are a couple toolstrip items in
the Text Editor toolbar which will comment and un comment a block of
text by adding the comment symbols at the beginning of each line.

Jim Wooley
http://devauthority.com/blogs/jwooley

Apr 20 '06 #5

P: n/a
Hello, cj,

<Ctrl-K><Ctrl-K> is toggling a bookmark.
<Ctrl-K><Ctrl-N> will move you to the next bookmark.
<Ctrl-K><Ctrl-P> will move you to the previous bookmark.

<Ctrl-K><Ctrl-C> "should" comment the selected block of text.
<Ctrl-K><Ctrl-U> "should" uncomment the selected block of text.

<Ctrl-C> (i.e. not preceded by <Ctrl-K>) will, as usual, copy the
currently selected text to the clipboard. As a new "feature", if no
text is selected the current line will be copied. (I haven't yet been
able to convince myself that this is an advantage.)

If these are not working for you, perhaps the shortcuts have been
redefined, as suggested in Larry's and Peter's notes.

Cheers,
Randy
cj wrote:
So the control command combinations don't work in the VB settings? They
don't work for me. Ctrl+K if pressed twice puts a blue block to the
left of the line. I have no idea what it means. Ctrl+K twice again
removes it. Ctrl+C doesn't do anything--that I can tell.

I just found the buttons on the menu.

Also I'm using VS2003.

Jim Wooley wrote:
Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */
It's something I'd like to have.

I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K,
Ctrl+U to comment or uncomment selected lines of text in VB but it
doesn't work for me. If anyone knows how let me know.

No, since the line break is the end of command identifier (as opposed
to the ; in C#, vb does not have continuation for the comments like
C#. The control command combinations might work if you use the C#
keyboard settings in VB. As an alternative, there are a couple
toolstrip items in the Text Editor toolbar which will comment and un
comment a block of text by adding the comment symbols at the beginning
of each line.

Jim Wooley
http://devauthority.com/blogs/jwooley

Apr 20 '06 #6

P: n/a
Ctrl+C is copy
"cj" <cj@nospam.nospam> wrote in message
news:eb**************@TK2MSFTNGP03.phx.gbl...
So the control command combinations don't work in the VB settings? They
don't work for me. Ctrl+K if pressed twice puts a blue block to the left
of the line. I have no idea what it means. Ctrl+K twice again removes
it. Ctrl+C doesn't do anything--that I can tell.

I just found the buttons on the menu.

Also I'm using VS2003.

Jim Wooley wrote:
Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */
It's something I'd like to have.

I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K,
Ctrl+U to comment or uncomment selected lines of text in VB but it
doesn't work for me. If anyone knows how let me know.


No, since the line break is the end of command identifier (as opposed to
the ; in C#, vb does not have continuation for the comments like C#. The
control command combinations might work if you use the C# keyboard
settings in VB. As an alternative, there are a couple toolstrip items in
the Text Editor toolbar which will comment and un comment a block of text
by adding the comment symbols at the beginning of each line.

Jim Wooley
http://devauthority.com/blogs/jwooley


Apr 20 '06 #7

P: n/a
> Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */


You could try:

#If False Then
This is a
multi-line
comment
in C
#End If

It isn't very pretty, but if you really have to have it, it will work. VB
won't treat this construct like a comment, so color syntax highlighting will
be strange.

Apr 20 '06 #8

P: n/a
cj
Oh $hit. They mean ctrl-k followed by ctrl-c not either one or the
other. Another worthless whatever to me. If I gotta find and do
control something twice to mark it and twice to unmark it and heck
ctrl-k and ctrl-c would probably take both hands. Darn it. I'll just
click the stupid icon on the tool bar. :(

Anyway, thanks for drumming it in my thick head. I simply hadn't
considered it'd be that complicated.

Oh, btw, I use ctrl-insert for copy and then shift-insert for paste.
It's so ingrained I had to do one and look at what my fingers are
hitting to write this. it takes one hand and I only have to move my
thumb up or down a tad to hit ctrl or shift while using my index finger
for insert. Give it a try sometime. It's a good thing. :)

R. MacDonald wrote:
Hello, cj,

<Ctrl-K><Ctrl-K> is toggling a bookmark.
<Ctrl-K><Ctrl-N> will move you to the next bookmark.
<Ctrl-K><Ctrl-P> will move you to the previous bookmark.

<Ctrl-K><Ctrl-C> "should" comment the selected block of text.
<Ctrl-K><Ctrl-U> "should" uncomment the selected block of text.

<Ctrl-C> (i.e. not preceded by <Ctrl-K>) will, as usual, copy the
currently selected text to the clipboard. As a new "feature", if no
text is selected the current line will be copied. (I haven't yet been
able to convince myself that this is an advantage.)

If these are not working for you, perhaps the shortcuts have been
redefined, as suggested in Larry's and Peter's notes.

Cheers,
Randy
cj wrote:
So the control command combinations don't work in the VB settings?
They don't work for me. Ctrl+K if pressed twice puts a blue block to
the left of the line. I have no idea what it means. Ctrl+K twice
again removes it. Ctrl+C doesn't do anything--that I can tell.

I just found the buttons on the menu.

Also I'm using VS2003.

Jim Wooley wrote:
Has MS included in VB2005 any multi-line comment methods like in C?
/* This is a
multi-line
comment
in C */
It's something I'd like to have.

I did read somewhere that I could use Ctrl+K, Ctrl+C and Ctrl+K,
Ctrl+U to comment or uncomment selected lines of text in VB but it
doesn't work for me. If anyone knows how let me know.
No, since the line break is the end of command identifier (as opposed
to the ; in C#, vb does not have continuation for the comments like
C#. The control command combinations might work if you use the C#
keyboard settings in VB. As an alternative, there are a couple
toolstrip items in the Text Editor toolbar which will comment and un
comment a block of text by adding the comment symbols at the
beginning of each line.

Jim Wooley
http://devauthority.com/blogs/jwooley

Apr 20 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.