Results 1 to 8 of 8

Thread: [RESOLVED] How do I use VB6 to prevent me from going looney!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    79

    Resolved [RESOLVED] How do I use VB6 to prevent me from going looney!

    Lol, needed a title that was going to snag my fellow geeks' intrigue. =)

    I am curious I have been floundering and thrashing about in the vast wave of VB Forums vigorously searching in vain to find an answer to my following dilemma:

    I am coding a VB6 application which uses a Rich Text Box. In this RTB I would like to have a specific templet of text that needs to be appended into the RTB in order to maintain conformity.


    The coding looks similar to this (note I am not at home at moment and can't cut n paste actual code):

    Dim strString as String

    strString = "____________________________________________________________" &
    strString = strString & txtDate.Text & " " & lstShift.Text & " " & txtName &
    strString = strString & "____________________________________________________________"
    rtb.Seltext = strString

    I was intending it to output like this:

    _____________________________________________________________
    01/10/2008 Graveyard Francisco
    _____________________________________________________________


    The problem is that when I attempt this I ended up getting an output that is all in one straight line that looks messed up similar to this:

    ________________________________________________01/10/2008 Graveyard Francisco_____________________________________________



    How do I send this preformatted text templet to the RTB box without it all being crammed together in one line? I assume I need to indicate line breaks but I have no clue how to send line breaks to the RTB. Please save what little bit I have left of my sanity!



    Your supreme help is greatly appreciated,
    Thanks Azeccia

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: How do I use VB6 to prevent me from going looney!

    Line breaks in vb can be any of the following 3:
    vbCrLf, vbNewLine, or chr$(13) & chr$(10)

    Try using one of those and append it to each line in your code...
    i.e., strString = strString & ... & vbNewLine
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    79

    Re: How do I use VB6 to prevent me from going looney!

    LaVolpe,

    Thank you very much for your prompt reply and not a second too late. =)

  4. #4
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: How do I use VB6 to prevent me from going looney!

    I read somewhere that vbcrlf is faster than vbnewline
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    79

    Re: How do I use VB6 to prevent me from going looney!

    isnoend07,

    I have seen vbcrlf used aswell but everytime I use it, It never seems to actually line break. mayhaps I was using it wrong?

  6. #6
    Hyperactive Member
    Join Date
    Jan 2006
    Location
    Pakistan
    Posts
    388

    Post Re: [RESOLVED] How do I use VB6 to prevent me from going looney!

    I would like to help you out but I can't really understand what you want.
    Does vbNewLine not help you?
    Its like this:
    Dim teststring As String
    teststring = "My name is " & vbNewLine & "lone_REBEL"
    this would mean

    My name is
    lone_REBEL

    hope it helps

  7. #7
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: How do I use VB6 to prevent me from going looney!

    Quote Originally Posted by Azeccia
    isnoend07,

    I have seen vbcrlf used aswell but everytime I use it, It never seems to actually line break. mayhaps I was using it wrong?
    dim line3 as string
    line3 = "I'm line 3"
    I use it all the time like this
    Msg = "I'm on line one" & Vbcrlf & "I'm on line 2" & vbcrlf & line3

    Notice 2 line have quotes and not the third
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    79

    Re: [RESOLVED] How do I use VB6 to prevent me from going looney!

    vbNewLine worked very well,
    Thanks a lot guys =)

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