[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
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
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. =)
Re: How do I use VB6 to prevent me from going looney!
I read somewhere that vbcrlf is faster than vbnewline
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?
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
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
Re: [RESOLVED] How do I use VB6 to prevent me from going looney!
vbNewLine worked very well,
Thanks a lot guys =)