|
-
Oct 21st, 2007, 06:05 AM
#1
Thread Starter
Frenzied Member
Scroll text from bottom of RTB
I am trying to add text one line at a time to a richtextbox.
I would like the new line to be added to the bottom of the RTB and the previous line to be moved up a line, to give the appearance of the text scrolling up to the top.
So far I have the following:
Code:
Private Sub Form_Load()
Dim myString As String
Dim tmpArray() As String
myString = "First line of text" & vbCrLf & vbCrLf & _
"Second line of text" & vbCrLf & vbCrLf & _
"Third line of text" & vbCrLf & _
"Fourth line of text"
tmpArray() = Split(myString, vbCrLf)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim i As Long
For i = 0 to Ubound(tmpArray)
RichTextBox1.Textrtf = RichTextBox1.rtf & vbcrlf & tmpArray(i)
Next i
I am guessing it's something to do with the timer code.
-
Oct 21st, 2007, 06:59 AM
#2
Re: Scroll text from bottom of RTB
there are some declaration issues i saw,
fixed them.
Code:
Private i As Long
Private tmpArray() As String
Code:
Private Sub Form_Load()
Dim myString As String
myString = "First line of text" & vbCrLf & vbCrLf & _
"Second line of text" & vbCrLf & vbCrLf & _
"Third line of text" & vbCrLf & _
"Fourth line of text"
tmpArray() = Split(myString, vbCrLf)
Timer1.Enabled = True
End Sub
Code:
Private Sub Timer1_Timer()
For i = 0 To UBound(tmpArray)
RichTextBox1.TextRTF = RichTextBox1.Text & vbCrLf & tmpArray(i)
Next i
End Sub
Edited.
Last edited by Fazi; Oct 21st, 2007 at 07:05 AM.
-
Oct 21st, 2007, 07:11 AM
#3
Re: Scroll text from bottom of RTB
akido, to insert a line to the top, you can do like this
Code:
Me.RichTextBox1.Text = "Hai" & vbCrLf & Me.RichTextBox1.Text
-
Oct 21st, 2007, 07:15 AM
#4
Thread Starter
Frenzied Member
Re: Scroll text from bottom of RTB
Thanks Fazi,
I have completely reworked this.
I now have the RTB inside of a picturebox and in the timer I set the top value of the RTB to decrease by 10, to give the effect of the text scrolling upwards.
Thanks for the reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|