Results 1 to 13 of 13

Thread: vbCrLf in a string

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    20

    vbCrLf in a string

    I have a program that I'm troubleshooting, and I have a bunch of strings that are as follows:

    bungcords = vbCrLf & "__ bungcords"
    Also, I have a few parts like this:
    If CheckBox1.Checked = True Then
    Input1 = vbCrLf & "__ " & txtInput1.Text
    End If
    Is that the proper syntax to be using? I'm not sure with this debugging stuff, because the program will run on my computer, but not on any others (with the Framework installed, of course). Thanks.

  2. #2
    New Member
    Join Date
    Jun 2002
    Posts
    8
    I can't see any problem in your code !!

    But be aware that the new line comes before the text. If the control u are using have space for only one line, you will not see the text.

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    try adding \n as that is used for line breaks now in .NET

    "Hello\n Chris"

    should look like this in a texbox

    Hello
    Chris
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    no its not used in .NET ...its just in c++ and c# not in vb

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    20
    Thanks for the responses! I'm working on the project right now. WHEN I get it working (I will if it's the last thing I do) I'll post back. Same thing goes if I have any more questions develop.

    EDIT**

    I can't seem to get the \n to work properly. For a buttons click event:

    TextBox1.Text = "This is some\n Text"
    It Prints it exactly like that. Am I using that correct way, or am I missing something? With a couple quick glances at the Help, I'm still clueless (as usual for me with MS help...).
    Last edited by Dodgeram01; Aug 1st, 2002 at 05:04 PM.

  6. #6
    New Member
    Join Date
    Jul 2002
    Posts
    4

    /n is not vb

    As PT Exorcist said, /n is not vb code. It only works with C++ and C#.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    20
    I see. I thought he was referencing the vbCrLf part. But that explains it then.

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    sorry I use both C# an VB so I get confused from time to time.

    LOL
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    yes i at start thought we could use \n too but tested and it seemed not to work lol

  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Did you try:
    ControlChars.NewLine
    Or ControlChars.CrLf

  11. #11
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261

    Re: vbCrLf in a string

    Originally posted by Dodgeram01

    Is that the proper syntax to be using? I'm not sure with this debugging stuff, because the program will run on my computer, but not on any others (with the Framework installed, of course). Thanks.
    That code should work no problem. Are you sure that your errors aren't caused by something else?

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    20
    It's gotta be, because trying a few more of the changes still yields errors. Time to get out the fine tooth comb it sounds like...

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    20
    Well, a little update. I solved the problem. On some accessory forms, I had them closing with just
    Close()
    . I changed them to
    Me.Close()
    and it now runs. Thanks for your help everyone, and I'm sorry that vbCrLf wasn't the issue. But I did learn some stuff, such as the ControlChars.NewLine commands.

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