Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: colors in richtextbox

104| Wed, 05 Dec 2007 07:07:00 GMT| mariuswb| Comments (6)
How can i make different colors in a richtextbox.

I want everything inside /* and */ be green.
Example:

/* hello there
Everything inside, will be green
lalala */

I want all public be blue

public void() /* Its java :p */

i want void, int, string, boolean and final be blue too.

public boolean() {

I want = * + - ( ) [ ] { } 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ; if, to be green

Example 1:
public int test = 3123;

Example 2:
public void testing() {
if(blablablabla) {
client.string.test[]
test = 5 * 7 - 3 + 4; //this will be green too. Just at same line ;)
}

everything after // (at same line) will be green

But i dont know how to make it :S
Everything over is java, and java codes will be made in the richtextbox.

- Marius

Keywords & Tags: colors, richtextbox, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/80668/
 
«« Prev - Next »» 6 helpful answers below.
If someone write public in a textbox, it will be merged with blue color.

Example:

Public will always get blue if you write Public
So if the text is Public then it get blue...

I hope you understand.

- Marius
if you want to use different colors you will need to use a Richtextbox.

markgambo | Mon, 03 Dec 2007 15:04:00 GMT |

I use that.
Got an example please? Of code i need.

mariuswb | Mon, 03 Dec 2007 15:05:00 GMT |

You'll find what you need (and a lot more) in this thread. (http://www.vbforums.com/showthread.php?t=355994&highlight=richtextbox)

martinliss | Mon, 03 Dec 2007 15:06:00 GMT |

Didnt understand the highlight stuffs there

mariuswb | Mon, 03 Dec 2007 15:07:00 GMT |

Didnt understand the highlight stuffs there

Did you try any of the examples that Moeur posted?

markgambo | Mon, 03 Dec 2007 15:08:00 GMT |

Yea.
You think you could explain it a bit better?

mariuswb | Mon, 03 Dec 2007 15:09:00 GMT |

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories