how to display line numbers in text box

R

rammohan

i want to implement an option similar to line numbers
option in c# editor. how can i display line numbers on
left side in text box.how can i know the present cursor
location with respect to control.
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

Hi,
i want to implement an option similar to line numbers
option in c# editor. how can i display line numbers on
left side in text box.how can i know the present cursor
location with respect to control.

You can using this:

string fullText=textBox1.Text;
int linesInFullText=wholeText.Split('\n').Length;
string textToCursor=wholeText.Substring(0, textBox1.SelectionStart);
int currentLineNumber=(textToCursor.Split('\n').Length-1);

But i can not invent any good presentation of line numbers other
than e.g. ListBox on the left side of TextBox.

Regards

Marcin
 
B

BlueFox

Yeah,that's what i really want.
Display the line number in the first column is substitute.
 

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