Richtextbox Question!

TheStorm
01-26-2004, 07:53 AM
I've tried but no luck!

I'm using a richtextbox to be able to have different colors for different lines. When I add a new line to the text box then I want it to be in the end! like this (not using the exact code...just to make you understand) Richboxtext = Richboxtext & vbcrlf & mynewline

If I do it like this then it will give the whole text the same formating as the format I use for the "mynewline". If I set it to red color everything becomes red. This would not be a problem if I wanted every new line to be first in the text box (then I could just add a line with the format I want, but I want every new line to be last.

Any Idea on how I can keep the format of the old text and add a new line in the end.

Hope you understand what I mean....and hopefully I have missed some easy solotion for this ;)

John
01-26-2004, 08:03 AM
If I understand you correctly then you are going to have to get to know the RTF specification pretty well, specifically the colortbl and how to use it.

Here is something that should help you get started: http://www.visualbasicforum.com/showthread.php?threadid=13512

TheStorm
01-26-2004, 08:24 AM
Tnx! and as usual I missed something simple...If I use this then it behaves as I want it!

RichTextBox1.SelStart = (Len(RichTextBox1.Text))
Then add my textline!

TheStorm
01-26-2004, 08:28 AM
Accordning to the tutorial .Selstart = (Integer), does that mean that the maximum charachters in a textbox is the max of an integer?

John
01-26-2004, 08:29 AM
The SelStart is a long. Not sure what tutorial you were looking at, but it is wrong. Also, the RichTextBox and TextBox are two different things.

TheStorm
01-26-2004, 08:33 AM
The SelStart is a long. Not sure what tutorial you were looking at, but it is wrong. Also, the RichTextBox and TextBox are two different things.

In the link you gave me there was an zipped tutorial about RichTextBox, in one part is says

SelStart, SelLenght (Integer)
SelStart is the curren position of a......

Just assuming that since it said (integer) that it had to be an integer! (but it felt wrong ;) )

John
01-26-2004, 08:36 AM
According to the Object Browser it is a long in both the RichTextBox and the TextBox controls. That must have been an oversite in the tutorial.

TheStorm
01-26-2004, 08:40 AM
Yes! Probably....

And sorry for mixing the words textbox and richtextbox....! richtextbox is such a long word to type :huh:

TheStorm
01-26-2004, 03:52 PM
Is it possible to use some other colors then just vbBlue, vbBlack, vbRed etc..?? I would like to have a dark green color but it does not exist an vbDarkGreen...or something similar.

TheStorm
01-26-2004, 10:57 PM
Is it possible to use some other colors then just vbBlue, vbBlack, vbRed etc..?? I would like to have a dark green color but it does not exist an vbDarkGreen...or something similar.

Anyone? :confused:

John
01-27-2004, 05:52 AM
Public Const DARK_GREEN = &H8000&
'...
x.BackColor = DARK_GREEN
'...

TheStorm
01-27-2004, 08:20 AM
Public Const DARK_GREEN = &H8000&
'...
x.BackColor = DARK_GREEN
'...

Tnx! I also found out that this works

.SelColor = RGB(0, 128, 64)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum