• Welcome to Valhalla Legends Archive.
 

Newbie question..but I need assistance

Started by Crypticflare, January 06, 2003, 01:17 PM

Previous topic - Next topic

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

UserLoser

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

Example =
on Form_Load()
addRTB "Hello world!", vbRed

- Should work, works for me

Crypticflare

#2
Good Deal, thanks a lot User.

UserLoser

#3
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.

Mesiah / haiseM

#4

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

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.
]HighBrow Innovations
Coming soon...

AIM Online Status: 

jnem

#5
"as high as you want it"? Riiight.

Zakath

#6
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.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Eibro

#7
Yes, pass an unlimited amount of arguments...
Until you cause a stack overflow

I think thats what jnem was getting at.
Eibro of Yeti Lovers.

Zakath

#8
Stack corruption is more fun. Sometimes it crashes, sometimes it doesn't. It's like the Wheel of Fortune!
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Yoni

#9
And sometimes it can be exploited to run malicious code. :)

zraw

#10
and sometimes we all meet in the mens bathroom, and 'accidently' drop our pants. nobody complains...

Yoni

#11
This is the programming forum - your childhood is off-topic!

Banana fanna fo fanna

#12
LOL warz

bin_laden

#13
Score:

Yoni     Warz
----     ----
 1        0

Adron

#14
Quoteand sometimes we all meet in the mens bathroom, and 'accidently' drop our pants. nobody complains...

Off-topic post; IP of poster banned from forum.