By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,449 Members | 1,601 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,449 IT Pros & Developers. It's quick & easy.

how to display line numbers in text box

P: n/a
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.

Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Nov 15 '05 #2

P: n/a
Yeah,that's what i really want.
Display the line number in the first column is substitute.

"rammohan" <mu************@rediffmail.com> дϢ
news:e9****************************@phx.gbl...
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.

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.