Home All Groups Group Topic Archive Search About
Author
20 Apr 2006 1:27 PM
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.

Author
20 Apr 2006 1:37 PM
Peter Macej
> 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
Author
20 Apr 2006 1:56 PM
Larry Lard
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
Author
20 Apr 2006 1:51 PM
Jim Wooley
> 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
Author
20 Apr 2006 1:59 PM
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:
Show quoteHide quote
>> 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
>
>
Author
20 Apr 2006 4:08 PM
R. MacDonald
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:
Show quoteHide quote
> 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
>>
>>
Author
20 Apr 2006 6:43 PM
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:
Show quoteHide quote
> 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
>>>
>>>
Author
20 Apr 2006 4:14 PM
TonyMast
Ctrl+C  is copy


Show quoteHide quote
"cj" <cj@nospam.nospam> wrote in message
news:ebhLvKIZGHA.2376@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
>>
Author
20 Apr 2006 4:48 PM
AMercer
> 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.