Reputation:
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
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