Linecount in multiline textbox

  • Thread starter Jesper, Denmark
  • Start date
J

Jesper, Denmark

Hi,

In case of an error in an input file, I inform the user which line in the
file (i.e. the string) were the file were encountered.

The user will then need to navigate to this line in the somewhat long text
file shown in a textbos (no word wrap). However he needs to count line
himself!!.

I would like a lable outside the textbox to show the line number on which
the caret is placed.

What event do I need to hook up on if I want to be notified when the caret
has changed, and how do I get the position (then I can count lines to this
pos) of the caret in the string that the textbox shows?

Thanx for your help. Very appreciated.
Jesper.
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi,

In case of an error in an input file, I inform the user which line in the
file (i.e. the string) were the file were encountered.

The user will then need to navigate to this line in the somewhat long text
file shown in a textbos (no word wrap). However he needs to count line
himself!!.

I would like a lable outside the textbox to show the line number on which
the caret is placed.

What event do I need to hook up on if I want to be notified when the caret
has changed, and how do I get the position (then I can count lines to this
pos) of the caret in the string that the textbox shows?

Thanx for your help. Very appreciated.
Jesper.

You would have to handle KeyDown, to knwo when then arrow is used,
then y ou will need to update the label that displays the position.

I would look for a more editor oriented control though. The provided
TextBox looks kind of shortcoming for what you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top