473,379 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Line Numbers in RichTextBox..

Hi, could any1 kindly tell me how to implement line numbers with a rich
text box (im making my own scripting language and really need line numbers!)

Ive looked all over the net for over 4 days now and just cant find
anything. Ive found C# versions but these are no good, because Im only
familiar with VB.NET.

Any help would be very much appreciated.

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #1
3 7881
"Adam Eavy via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
Hi, could any1 kindly tell me how to implement line numbers with a rich
text box (im making my own scripting language and really need line
numbers!)

Ive looked all over the net for over 4 days now and just cant find
anything. Ive found C# versions but these are no good, because Im only
familiar with VB.NET.


If you have the C# code of a textbox which supports line numbers, you could
compile a C# class library and use this class library from your VB.NET EXE
application.

SharpDevelop contains an editor control written in C#:

SharpDevelop @ic#code
<URL:http://www.icsharpcode.com/OpenSource/SD/>

Commercial solutions:

Syncfusion: Essential Edit
<URL:http://www.syncfusion.com/products/product.aspx?p=3>

SyntaxEditor .NET Control
<URL:http://www.actiprosoftware.com/Products/DotNet/SyntaxEditor/>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Thanks for your reply

However, none of the C# Converters correctly convert the code (this
includes #Develop) and are causing errors that I cannot manage to find a
solution for.

Ive decided after all this time that Im going to have to attempt to battle
the problem with another solution, someone mentioned about using 2
RichTextBoxes.

So I have started trying it out, problem is this:

I have no trouble getting the f1rst RTB (the one with line numbers) to add
line numbers when the Return key is pressed in the second RTB, but I cannot
find a solution to determine when the user has removed a line (by pressing
backspace) and following this, I dont know how to remove the appropriate
line number!

Not sure if you could maybe help me with this, but Im starting to run out
of hair to pull out now! and would greatly appreciate any support

Many Thanks in advance

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #3
Don't bother implemeting 2 RTB's I've tried countless methods using this
approach and everytime there seems to be a new crop of bugs that arise from
it. The only relative suCcess I've had was using unmanaged code to sync
events for the RTB's.

BUT.

I ended up writing my own extended RTB control -- it DOES use unmanaged
code to modify the NCA (non client area) of the control to draw a gutter
for the line numbers. I'm currently using it in a project and it's stable,
the only drawback to the control is that once you start getting into files
with over 1,500 or so lines, performance really starts to crap out. This is
more a fault of the native RichTextBox contol that's been there since VB
Classic.

FYI: I've added some nice customization into the control such as:
1. line number font
2. line number color
3. gutter backcolor
4. gutter divider
5. current linenumber highlight forecolor
6. current linenumber backcolor

and a few other things too.

If you want, I would be willing to either sell you a copy of the control,
or do an exchange of some sort? email me:
sp***@dowco.com,cm*****@fuelindustries.com

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Cengiz Ulku | last post by:
Hi, How can look for only the numbers in a RTB control? I know for instance how to search for a string by using: : Private Sub Command1_Click() Dim FoundPos As Integer Dim FoundLine As...
1
by: Miguel | last post by:
Hi, Can anyone help on how to add a line number section to a RichTextBox? In the same way any code editor have... thanks in advance
2
by: Martin Dew | last post by:
I have a RichTextBox called rtbOutput. I am adding lines of text using the AppendText method. What I want to do is immediately after adding this line of text make sure that this line of text is...
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
4
by: M O J O | last post by:
Hi, I'm using a RichTextBox with WordWrap=True and MultiLine=False. When the text is to long, it fills more lines. How do I get the number of lines the text uses? Thanks!
2
by: Just Me | last post by:
I insert text in a RichTextBox ending each line with vbCrLf. I think when I search the RichTextBox text I do not find any CR's. In the Text property is the end of line char a LineFeed? Are...
0
by: John Smith | last post by:
I have text files and I get binary offsets of text portion of these files from VB6 program with RichTextBox. I use VB.Net 2003 and need to select and highlight the text between given offsets....
2
by: coding | last post by:
Hi, Can anyone help on how to add a line number section to a RichTextBox? In the same way any code editor have... thanks in advance
4
by: Franky | last post by:
What I want to do is delete the last line in a RichTextBox. The RichTextBox has a ReadOnly property called lines that seems like it might help but I cant figure out how to use it. Well, the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.