Results 1 to 11 of 11

Thread: Multi line comments...

  1. #1

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Multi line comments...

    Hmm, I was wondering if there is a way in VB to use multiline comments. You can comment your code by putting this ' or REM in front of a line, but if you want more than one line commented you have to add them to every line apart...

    Is there a way to use multiline comments in VB? E.g. in Java it's done like this:
    Code:
    */Comment
    Another comment
    Yet another/*
    Don't tell me MS didn't implement this...
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109
    There is no way that I am aware of. I tried the C-style comment /*....*/, but it didn't work.

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Try adding a line continuation.

    VB Code:
    1. 'This is a _
    2. multiline comment

    Its the best you are going to be able to do.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109
    All in all, it is a pretty trivial issue because there is no line wrap to speak of. I like to have all the comments visible without scrolling. However, when I write on a large screen, the comments can be pretty long, but once I move to a small screen, they overrun the width of the page. Thus whether I use one awkward comment designator at beginning and end, or one easy one per line, it really doesn't much matter. Either way isn't the best.

  5. #5

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    Originally posted by crptcblade
    Try adding a line continuation.

    VB Code:
    1. 'This is a _
    2. multiline comment

    Its the best you are going to be able to do.
    Doesn't work... looks like MS didn't implement it...
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  6. #6
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by TheVader
    Doesn't work... looks like MS didn't implement it...
    Works fine for me.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    Originally posted by Shaggy Hiker
    All in all, it is a pretty trivial issue because there is no line wrap to speak of. I like to have all the comments visible without scrolling. However, when I write on a large screen, the comments can be pretty long, but once I move to a small screen, they overrun the width of the page. Thus whether I use one awkward comment designator at beginning and end, or one easy one per line, it really doesn't much matter. Either way isn't the best.
    You got a point, but what I'm actually trying to do is comment out some code because it doesn't work yet and it screws up the part that should work. But I'm not gonna take the hassle of putting REM before each line... guess I'll have to cut it to the clipboard...
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  8. #8
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    the _ is exactly the way to go
    VB Code:
    1. [color=green]' a multi line comment _[/color]
    2. [color=green]by dynamic sysop _[/color]
    3. [color=green]the end ...[/color]
    4.  
    5. [color=blue]Private[/color] Const Testing = 123
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  9. #9

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    Originally posted by crptcblade
    Works fine for me.
    You're right, it does. I forgot to add the space between the 'a' and the '_'. But even then, you'll have to add it to every line separately.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  10. #10
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by TheVader
    You got a point, but what I'm actually trying to do is comment out some code because it doesn't work yet and it screws up the part that should work. But I'm not gonna take the hassle of putting REM before each line... guess I'll have to cut it to the clipboard...
    Just use Block Comment/Uncomment on the Edit toolbar.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  11. #11

    Thread Starter
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    Originally posted by crptcblade
    Just use Block Comment/Uncomment on the Edit toolbar.
    Never knew of that option. Thanks.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

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