• Welcome to Valhalla Legends Archive.
 

Multiple RTB

Started by Crim-Training, October 21, 2003, 12:20 AM

Previous topic - Next topic

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

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

bmwrb16

Err g2g i'll help you in like 3 hours

CrAz3D

Try copy & pasting that AddChat sub & call it, for example, AddChat2.  Then just make AddChat2 add the text to the other RTB.
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Crim-Training

thx CrAz3D, i love you

CupHead

#4
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

Crim-Training

thx they both work, greatly appreciated

bmwrb16

Yeah, i was going to so that bleh..