Author | Message | Time |
---|---|---|
Crypticflare | In VB 6.0 I want my RTB to like output a message on startup like "Welcome To Blah Blah" It's not for a bot or anything, I just wanted to play around with it, so I think I need a simple string output. and I don't know how to do that.. any assistance is much appreciated | January 6, 2003, 7:17 PM |
UserLoser | [CODE] Public Sub addRTB(ByVal txtOne As String, ByVal clrOne As Long, Optional ByVal txtTwo As String, Optional ByVal clrTwo As Long, Optional ByVal txtThree As String, Optional ByVal clrThree As Long, Optional ByVal txtFour As String, Optional ByVal clrFour As Long, Optional strType As String) txtOne = Replace(txtOne, vbCrLf, "") txtTwo = Replace(txtTwo, vbCrLf, "") txtThree = Replace(txtThree, vbCrLf, "") txtFour = Replace(txtFour, vbCrLf, "") Call AddChat(clrOne, txtOne, clrTwo, txtTwo, clrThree, txtThree, clrFour, txtFour) frmMain.RTB.SelStart = Len(frmMain.RTB.text) End Sub Public Sub AddChat(ParamArray saElements() As Variant) Dim Data As String With frmMain.RTB .SelStart = Len(.text) .SelLength = 0 .SelColor = vbWhite .SelStart = Len(.text) End With Dim i As Integer For i = LBound(saElements) To UBound(saElements) Step 2 With frmMain.RTB .SelStart = Len(.text) .SelLength = 0 .SelColor = saElements(i) .SelText = saElements(i + 1) & Left$(vbCrLf, -2 * CLng((i + 1) = UBound(saElements))) .SelStart = Len(.text) Data = Data & saElements(i + 1) End With Next i End Sub [/CODE] Example = on Form_Load() addRTB "Hello world!", vbRed - Should work, works for me | January 6, 2003, 7:24 PM |
Crypticflare | Good Deal, thanks a lot User. | January 6, 2003, 7:28 PM |
UserLoser | No problem, just msg me on AIM, Yahho, ICQ, if you need any other things and i'll try to help out if im not to busy. | January 6, 2003, 7:36 PM |
MesiaH | [code]Public Sub rtbAdd(MyRichTextBox As RichTextBox, ParamArray saElements() As Variant) 'This is a nice nice nice way to add colored text to a rich text box Dim i As Integer For i = LBound(saElements) To UBound(saElements) Step 2 With MyRichTextBox .SelStart = Len(.Text) .SelLength = 0 .SelColor = saElements(i) .SelText = saElements(i + 1) .SelStart = Len(.Text) End With Next i End Sub[/code] call rtbadd vbgreen, "hi my name is: ", vbwhite, "Bob; ", vbcyan, "and i have big boobies" & vbcrlf the format goes like that as high as you want it. | January 7, 2003, 2:23 AM |
jnem | "as high as you want it"? Riiight. | January 7, 2003, 6:22 PM |
Zakath | He means it uses a param array (unspecified number of arguments). You can do the same thing in C by declaring a function with ... as the final parameter. | January 9, 2003, 12:54 AM |
Eibro | Yes, pass an unlimited amount of arguments... Until you cause a stack overflow I think thats what jnem was getting at. | January 9, 2003, 3:38 PM |
Zakath | Stack corruption is more fun. Sometimes it crashes, sometimes it doesn't. It's like the Wheel of Fortune! | January 9, 2003, 4:05 PM |
Yoni | And sometimes it can be exploited to run malicious code. :) | January 11, 2003, 2:34 PM |
zraw | and sometimes we all meet in the mens bathroom, and 'accidently' drop our pants. nobody complains... | January 11, 2003, 4:38 PM |
Yoni | This is the programming forum - your childhood is off-topic! | January 11, 2003, 4:40 PM |
St0rm.iD | LOL warz | January 16, 2003, 8:24 PM |
bin_laden | Score: Yoni Warz ---- ---- 1 0 | January 18, 2003, 4:08 AM |
Adron | [quote]and sometimes we all meet in the mens bathroom, and 'accidently' drop our pants. nobody complains...[/quote] Off-topic post; IP of poster banned from forum. | January 18, 2003, 12:45 PM |
MesiaH | bout time, go yoni! | January 19, 2003, 11:19 PM |