Results 1 to 15 of 15

Thread: Commenting blocks of code

  1. #1
    Guest
    Is there a way to comment a block of code, besides manually going to each line and ' ing it for each line? I mean, if C++ and Java have it, Visual Basic should have it too!

    -Jordan

  2. #2
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    Not that I know of. I slightly checked one time and never found out how.
    Chris

  3. #3
    Member
    Join Date
    Nov 1999
    Location
    Manila, Philippines
    Posts
    59

    1. Right click on your toobar and check Edit
    2. Select your block of codes to comment
    3. From the new set of toolbars, click on Comment Block

    Note:
    Other handy editing tools are provided as well as form editor tools.

    hope this help.
    Mikey
    A/P
    Using VB6 SP4 Enterprise Ed.

  4. #4
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    There is a way, I found it in the MSDN library

    1. Your right click (in the toolbar area) and click on the EDIT toolbar

    2. there are 2 buttons there. They have aqua blue lines in them. so you highlight the text that you want to comment then you click the left button and it automaticly adds the ' infront of very line, then the second button (to the right of it) un comments the code
    NXSupport - Your one-stop source for computer help

  5. #5
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    Good stuff. That toolbar is now docked to my other ones...
    Chris

  6. #6
    Guest

    Talking fantastic

    Thanks.. too bad there's no syntax to do it manually (I personally hate using the mouse for anything)

  7. #7
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    you can do what I do sometimes:

    Arrow Down
    Arrow Left
    '

    Arrow Down
    Arrow Left
    '
    etc....
    NXSupport - Your one-stop source for computer help

  8. #8
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    arrow down
    arrow home

    that's what I do, quick enough...
    Chris

  9. #9
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    tell you'll have to strech your fingers to get both keys rapidly as where the arrows you can use your middle finger and index
    NXSupport - Your one-stop source for computer help

  10. #10
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    Oh, I'm using the numeral keypad to move around. I know it's not a good habit, but since my early commodore 64 years I used it that way =)

    That's why I use 'Home'.
    Chris

  11. #11
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    why isn't it a good habit
    I'm not saying its a good habit, but its just not a bad habit, its just a prefrence
    NXSupport - Your one-stop source for computer help

  12. #12
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    I called it a bad habit since it often happens that someone uses my computer after me and they try using the numeral keypad as it's meant to be used: for typing numbers.

    I often find myself more comfortable using that pad to type numbers so I have to toggle the Num Lock all the time.

    For me it's a bad habit =) Arrows should work just fine... although it's nice to have the pgup, pgdn, home and end near.
    Chris

  13. #13
    Guest
    dimava, I meant there's no actual syntax to comment big chunks of code ala Java: /*

    Highlighting the text and clicking a toolbar button just to comment code is just too much work!!

  14. #14
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    ...thought I was lazy...
    Chris

  15. #15
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Actually there is a Syntactical way, place the apostrophe at the beginning of the block, then at the end of each line add a space and an underscore, i.e. [CODE]Private Sub Form_Load()
    'Commented Block of Code _
    See This 2nd Line is Commented too!
    End Sub[CODE]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width