Valhalla Legends Forums Archive | Visual Basic Programming | Help with RichTextBox

AuthorMessageTime
DarkSoldier
Ok i just started trying to make a little bot... i used the richtx32.ocx to get a box where i can use different colors, but i cant find any site where its really good explained how to use colors. Everytime if i maybe found a way to use colors i get errors...
an example:

Writing the line then searching for it, selecting it and changing its color....
or
Setting a color, then writing the line...
nothing works for me, or i just use this code wrong,,,
can some1 give me a real easy example of a working color code?
August 20, 2004, 8:19 PM
BaDDBLooD
[code]

Public Function AddChat(ByVal RTB as RichTextBox, ParamArray Blub() As Variant)
Dim i As Integer
With RTB
.SelStart = 99999999
.SelLength = 0
.SelColor = vbWhite
.SelText = "[" & Time & "] "
.SelStart = 99999999
End With
For i = LBound(Blub) To UBound(Blub) Step 2
With RTB
.SelStart = 99999999
.SelLength = 0
.SelColor = Blub(i)
.SelText = Blub(i + 1) & Left$(vbCrLf, -2 * CLng((i + 1) = UBound(Blub)))
.SelStart = 99999999
End With
Next i
End Function

[/code]

Sample Usage:

[code]

AddChat frmMain.rtbChat, vbYellow, "Welcome!"

[/code]

More than one color?

[code]

AddChat frmMain.rtbChat, vbYellow, "w", vbGreen, "e", vbYellow, "l", vbGreen, "c", vbYellow, "o", vbGreen, "m", vbYellow, "e", vbBlue, "!"

[/code]
August 20, 2004, 8:30 PM
DarkSoldier
uh fast reply, thanks a lot!
im going to test that now...
August 20, 2004, 8:35 PM
BaDDBLooD
[quote author=DarkSoldier link=board=31;threadid=8264;start=0#msg76434 date=1093034121]
uh fast reply, thanks a lot!
im going to test that now...
[/quote]

Well?
August 20, 2004, 10:25 PM
Networks
Can anyone provide a RichText Box tutorial really quick? Just things like making part of a line bold and the next not or maybe even the whole line. Something simple to understand and use, so I can italize as well.
August 20, 2004, 10:27 PM
DarkSoldier
ok, tested it and modified it a little bit, works fine!
August 24, 2004, 10:03 PM
R.a.B.B.i.T
[quote author=Networks link=board=31;threadid=8264;start=0#msg76450 date=1093040873]
Can anyone provide a RichText Box tutorial really quick? Just things like making part of a line bold and the next not or maybe even the whole line. Something simple to understand and use, so I can italize as well.
[/quote].SelBold = True
.SelItalic = True

It's not that hard....
August 24, 2004, 10:25 PM
Networks
[quote author=R.a.B.B.i.T link=board=31;threadid=8264;start=0#msg77210 date=1093386314]
[quote author=Networks link=board=31;threadid=8264;start=0#msg76450 date=1093040873]
Can anyone provide a RichText Box tutorial really quick? Just things like making part of a line bold and the next not or maybe even the whole line. Something simple to understand and use, so I can italize as well.
[/quote].SelBold = True
.SelItalic = True

It's not that hard....
[/quote]

Wow.. it really isn't. Anyway thanks :)
August 25, 2004, 10:59 PM
Myndfyr
You can do what I've done and create a rich text generator. It's not that bad once you've figured out the general syntax and formatting rules. :)
August 25, 2004, 11:27 PM

Search