[.net] Syntax highlighting in VB?

Started by
3 comments, last by zangetsu 17 years, 5 months ago
Hi! I want to make an application that uses syntax highlighting. I've tried everything on my own but can't seem to find a smart way of doing what I want. Can anyone point me in the right direction, show me some source code that does this or lead me to another forum where someone will be able to answer my question? Preferably Visual Basic (.NET-2005) but I guess I can understand som C# if I try. Thanks in advance!
Advertisement
http://www.codeproject.com/vb/net/realtimesyntaxcoloring.asp
http://www.codeproject.com/vb/net/RTBClass.asp
My previous attempts have been to use the RichTextBox control and to hack in my own code to transform the colour of blocks. This works, to some extent, but soon becomes an ugly mess of Win32 hacks if you start adding lots of extra functionality to it.

There are a number of examples on the Code Project for this technique, such as this one.

Since then, I have started writing my own text editor control. Given that I directly control the rendering, I don't have to worry about it deciding to do anything crazy and can add as much functionality as I so desire. It's a simple, but large task, though. There are a number of commercial solutions, like this one, and some freeware ones that can be dredged up from a web search. I can't speak for their quality.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Thank you!
I will take a good look at all the examples and have a moment of thinking. I'll be back with the results. Please continue to post good examples :)

Thank you again.
I like to use ICSharpCode.TextEditor. Its the part of SharpDevelop that does their syntax highlighting. It is LGPL code, but since its in a seperate .Net Assembly, it should be OK to use it in just about any project.

Unfortunately there is little documentation on how to use it. I had to figure it out by reading the SharpDevelop Source. Maybe I ought to write up a tutorial, If I am going to keep pitching it when people ask about syntax highlighting....

This topic is closed to new replies.

Advertisement