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
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
any help is appreciated
Err g2g i'll help you in like 3 hours
Try copy & pasting that AddChat sub & call it, for example, AddChat2. Then just make AddChat2 add the text to the other RTB.
thx CrAz3D, i love you
Rather than making an entirely new function, it might be easier to just specify the RTB in the arguments like so:
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
thx they both work, greatly appreciated
Yeah, i was going to so that bleh..