Results 1 to 9 of 9

Thread: line continuation character (_)

  1. #1
    Guest

    Angry

    Why does vb reject this character when I use it to break a line up? I am not using it within a string expression.

    Any help would be appreciated.

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    If you use the '_' always make sure a space preceed it.

    Code:
    Str = "The cat sat" & _
    " on the mat"
    
    If Text1.Text = vbNullString _
    Then
    'do something
    End If
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    ?
    Try this:

    Code:
    MsgBox "Hellooooooh" _
    , , "is it not working?"
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Guest
    I do ensure there is a space before the '_' character, it still refuses to work right. If I remove the '_' character, then the program works without a problem!

    Is this a VB Quirk or is it just taking the day off seeing its Friday?? *lol*

  5. #5

  6. #6
    Guest
    If (Label1.Caption = 7) Or (Label2.Caption = 7) _
    or (Label3.Caption = 7) then
    Image1.Visible = True



  7. #7

  8. #8
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    change it to...

    Code:
    If (Label1.Caption = "7") Or (Label2.Caption = "7") _ 'add quotes
    Or (Label3.Caption = "7") Then _  'add _ here 
    Image1.Visible = True
    adding the underscore puts it all into one line allowing no end if
    (or just put end if on the line after Image1....)




    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  9. #9
    Guest
    You cannot have continuation line in quotes.

    (Example:
    string = "Hello _
    World")

    But you could have it like:

    string = _
    "Hello World"

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