user1280834
user1280834

Reputation:

RichTextBox - check if a linebreak was deleted

I build a little editor with linenumbers. Now I want to delete them if a linebreak is deleted. One way could be that I count the linebreaks on every textchanged event, but I don't like that. Is there a possibility to check if a linebreak was deleted?

Upvotes: 0

Views: 103

Answers (1)

Dmitrii Erokhin
Dmitrii Erokhin

Reputation: 1347

You could store line count in a variable, e.g. _linesCnt, then in TextChanged event you would compare _linesCnt to your richtextbox Lines.Count property and if they differ - recount your line numbers.

Upvotes: 1

Related Questions