Click here to Skip to main content
15,846,091 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
so i have an application im building to include in a desktop project
its basically a scripting program dealing with the codes: html, js, batch, asp, and machine
i though i would start with the html or batch as they are easiest
what i need is to convert every thing between "<" ">" or "%" "%" into blue, i want to change everything in quotes into red, and the batch commands im using like wmic and netsh to be green

i have seen a few examples in C but couldnt translate and touch up to fit my program

i am using a rich text box and have all the basic rtf namespaces

really it needs to be something that will activate in textchanged()

as a footnote, each text box is name by which code type i choose to load, i am also in the visual studio 2008 professional enviroment, i can code in the languages im building but havent quite got the hang of vb as of yet

thanks in advance
Sergey Alexandrovich Kryukov 6-Mar-12 14:17pm    
You need to specify the type of application and UI library you want to use. WPF? Forms? Silverlight? ASP.NET? What?
Tag it.
Sergey Alexandrovich Kryukov 6-Mar-12 14:18pm    
Should it be just viewer or editor as well?
Member 8696556 7-Mar-12 4:19am    
sorry if i didnt specify enough, its for text editor and form app.
@dave kresowiak i did look on google but i couldnt never terminate the color change, say if i entered a bracket the color would change to blue, but i couldnt get it to change back when i entered a close bracket

@derek9999 it has to be in and i need code not build into my program, not a complete program. and im not very good at translating C code.
derek9999 7-Mar-12 7:51am    
I use this control in my project, which is written in VB. The code translation was straightforward (I don't know C# very well either), plus the author answers questions very quickly. It already has VB syntax highlighting built in so there's little work to do on your part. You just drop it on a form and it works!

There's a ton of examples out on the web, even about a dozen articles here on CP. All you have to do is Google for "C# syntax highlighting" or " syntax highlighting". Some, of course, are going to be better than others.
Share this answer
This is the best one I've seen:

Fast Colored TextBox for Syntax Highlighting[^]

It's also very easy to use.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900