Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Quick VB Question

Options
  • 11-06-2002 5:47am
    #1
    Closed Accounts Posts: 1,322 ✭✭✭


    After spending a couple of hours coding in VB (it's been a while, lol), is there any way I can comment out entire blocks of either code or spoken language.

    I find it a bit tedious having to put an apostrophe or REM's before each line. Isn't there something similar to
    [PHP]
    /*
    a
    block
    of
    code
    */
    [/PHP]
    as there is in C/C++/Java.

    This is VB6 I'm talking about, just in case VB.NET introduced it (I don't wan't to hear about it).

    advTHANKSance ;)

    ;-phobos-)


Comments

  • Registered Users Posts: 1,393 ✭✭✭Inspector Gadget


    I... erm... don't think so...

    Gadget


  • Closed Accounts Posts: 76 ✭✭photty


    surely you can write a macro or script or something to prepend the ' before each line of a block of selected text?? I'm not that big on the MSDEV ide but I'd say it must be possible.


  • Closed Accounts Posts: 6,601 ✭✭✭Kali


    Add block commenting capability to VB's IDE

    Often when you code, you may want to comment out an entire block of code statements. Under normal circumstances, to do so you must comment out each line individually. Fortunately, Visual Basic's IDE provides a little-known way to let you comment entire blocks of code with the click of a button.

    Buried deep in the custom menu tools, VB's IDE offers two menu buttons that can make commenting and uncommenting code blocks very easy. For some reason, the IDE doesn't offer these commands automatically, so you'll need to add them yourself. To do so, right-click on any of the IDE's menubars, and select Customize from the resulting shortcut menu. In the Customize dialog box, select the Commands tab. Next, select Edit from the options in the Categories listbox. Now, scroll down the Commands listbox until you see two options called Comment Block and Uncomment Block. Drag these to commands onto the IDE's Standard toolbar.

    To use these commands, simply highlight a block of code, and then click the command (Comment or Uncomment) you wish to execute.



  • Closed Accounts Posts: 76 ✭✭photty


    There's a similar VBScript macro that comes with MSVC++ that comments out a selection of code using C style comments. I've looked at the macro and it also works for VB. So just go to Tools>Macro>Options>Loaded Files and select SAMPLE. Then asign the one called CommentOut to a button or whatever.


  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    I never actually ventured that far around the IDE, as regards seeing what customisable features there was. That drag and drop tool facility is class, you can place the tools, on the toolbar, or even in a menu. Very impressive. I will have to see what else is in there when I have the time. I will have to hand it to MS, for their GUI components, but that's about all I'll be handing :cool:

    Just in case you are reading this Al/Dav/Kealan, no I'm not turning in to a VB muppet.

    Thanks again, ;)
    ;-phobos-)


  • Advertisement
Advertisement