How can I do some code when the user changes what line the caret is on?
so something like:
sub textbox1_lineindexchanged (byval ....) Handles Textbox1.Lineindexchanged
'do code based on the current line
end sub
sorry, I am using a richtextbox, just I always used it so I just call it a textbox in my thoguhts.
I assume you are using Windows Forms so my answer is based on that. If you are using ASP.NET then you’ll need to do it with JavaScript and I have no idea how/if that’s possible.
In Windows Forms, you can create an event handler for the KeyUp and MouseUp events but there is no SelectionChanged event. If you switch to using a RichTextBox instead, you do have access to a SelectionChanged event.
In the event you would use the SelectionStart property of the textbox and pass that to the GetLineFromCharIndex method which will give you the line number. Hope this helps.