I have my scrollbar set as just a vertical one.
But for some reason my text sometime shows up like this:
(http://68.35.184.146/xeno/images/weird1.gif)
Public Function Chat(ByVal TimeStamp As Boolean, ByVal NewLine As Boolean, ByVal TextColor As Long, ByVal text As String)
If Len(Form1.RTB.text) > 20000 Then
With Form1.RTB
.Visible = False
.SelStart = 0
.SelLength = InStr(1, .text, vbLf, vbTextCompare)
.SelText = vbNullString
.Visible = True
End With
End If
Form1.RTB.SelStart = Len(Form1.RTB.text)
If NewLine = True And Form1.RTB.text <> "" Then
Form1.RTB.SelText = Form1.RTB.SelText & vbCrLf
End If
If TimeStamp = True Then
Form1.RTB.SelColor = &HC0C0&
Form1.RTB.SelText = "[" & Time & "] "
End If
Form1.RTB.SelColor = TextColor
Form1.RTB.SelText = Form1.RTB.SelText & text
Form1.RTB.SelStart = Len(Form1.RTB.text)
End Function
Any suggestions?
Public Function Chat(ByVal TimeStamp As Boolean, ByVal NewLine As Boolean, ByVal TextColor As Long, ByVal text As String)
If Len(Form1.RTB.text) > 20000 Then
With Form1.RTB
.Visible = False
.SelStart = 0
.SelLength = InStr(1, .text, vbLf, vbTextCompare)
.SelText = vbNullString
.Visible = True
End With
End If
Form1.RTB.SelStart = Len(Form1.RTB.text)
If NewLine = True And Form1.RTB.text <> "" Then
Form1.RTB.SelText = Form1.RTB.SelText & vbCrLf
End If
If TimeStamp = True Then
Form1.RTB.SelColor = &HC0C0&
Form1.RTB.SelText = "[" & Time & "] "
End If
Form1.RTB.SelStart = Len(Form1.RTB.Text)
Form1.RTB.SelLength = Len(text)
Form1.RTB.SelColor = TextColor
Form1.RTB.SelText = Form1.RTB.SelText & text
Form1.RTB.SelStart = Len(Form1.RTB.text)
End Function
That code is redundant. There's no point to set the start position at the end of the function and then the next time it's called reset it again!
Call AppendText(ChatOutput, vbGreen, "This is a ", vbRed, "test!" & vbCrLf)
Sub AppendText(ByVal RichEdit As RichTextBox, ParamArray OutputData() As Variant)
With RichEdit
.SelStart = Len(.Text)
.SelColor = vbBlack
.SelText = "[Timestamp] "
Dim I As Integer
For I = LBound(OutputData) To UBound(OutputData) Step 2
.SelColor = CLng(OutputData(I))
.SelText = CStr(OutputData(I + 1))
Next I
End With
End Sub
You also dont create a new line :P
He created he new line by adding vbcrlf into the text he was adding.
I used a modified version of what lobo gave me & what I add (from Fr0z3N?) & now it all seems to work.
THANKS!
No he didn't
Never mind. Sorta silly to do it that way though.
Quote from: Warrior on February 23, 2005, 04:32 PM
No he didn't
Never mind. Sorta silly to do it that way though.
Word, that is why CrAz3D didn't use his exact code.
Why do you talk about yourself in 3rd person? Its kind scary. :-\
Cause I love me?
Quote from: CrAz3D on February 23, 2005, 04:27 PM
He created he new line by adding vbcrlf into the text he was adding.
I used a modified version of what lobo gave me & what I add (from Fr0z3N?) & now it all seems to work.
THANKS!
You can't better yourself from copy and paste tactics lol, do you know what the problem was and how they fixed it.
From the screen shot it looks to me like somone forgot to turn on the wordwrap.
Quote from: soLo.abUse on February 22, 2005, 08:05 PM
That code is redundant. There's no point to set the start position at the end of the function and then the next time it's called reset it again!
Setting the start position at the beginning of the function assures that the insertion point really is at the end of the text. Setting it at the end makes sure the rich text box scrolls down to show the new lines if they are off the visible area.