Valhalla Legends Forums Archive | Visual Basic Programming | Multiple RTB

AuthorMessageTime
Crim-Training
im trying to add 2 seperate rich txt box's to my form, but i dont know how to edit the module can someone help me ?

this is what i got so far
[code]
Public Function AddChat(ByVal txtOne As String, ByVal clrOne As Long, Optional ByVal txtTwo As String, Optional ByVal clrTwo As Long, Optional ww As Integer)
Dim txtchat1 As RichTextBox
On Error Resume Next
If ww = 1 Then
Set txtchat1 = Form1.Talk
Else
Set txtchat1 = Form1.Talk
End If

With txtchat1
.SelStart = Len(.Text)
.SelLength = 0
.SelColor = vbWhite
.SelText = "[" & Time & "] "
.SelColor = clrOne
.SelText = txtOne
End With

If Len(txtTwo) > 1 Then
With txtchat1
.SelStart = Len(.Text)
.SelLength = 0
.SelColor = clrTwo
.SelText = txtTwo
End With
End If
End Function [/code]

any help is appreciated
October 21, 2003, 5:20 AM
bmwrb16
Err g2g i'll help you in like 3 hours
October 21, 2003, 11:24 AM
CrAz3D
Try copy & pasting that AddChat sub & call it, for example, AddChat2. Then just make AddChat2 add the text to the other RTB.
October 21, 2003, 1:54 PM
Crim-Training
thx CrAz3D, i love you
October 21, 2003, 1:59 PM
CupHead
Rather than making an entirely new function, it might be easier to just specify the RTB in the arguments like so:

[code]
Public Function AddChat(RTB as RichTextBox, ByVal txtOne As String, ByVal clrOne As Long, Optional ByVal txtTwo As String, Optional ByVal clrTwo As Long)
On Error Resume Next

With RTB
.SelStart = Len(.Text)
.SelLength = 0
.SelColor = vbWhite
.SelText = "[" & Time & "] "
.SelColor = clrOne
.SelText = txtOne
End With

If Len(txtTwo) > 1 Then
With RTB
.SelStart = Len(.Text)
.SelLength = 0
.SelColor = clrTwo
.SelText = txtTwo
End With
End If
End Function
[/code]
October 21, 2003, 2:27 PM
Crim-Training
thx they both work, greatly appreciated
October 21, 2003, 2:33 PM
bmwrb16
Yeah, i was going to so that bleh..
October 21, 2003, 5:14 PM

Search