Reputation: 59516
How do I get notified of a selection change in a text box in .NET 2.0? I was unable to find a SelectionChanged event or an OnSelectionChanged method. What is the best workaround for this (without having to PInvoke, of course)?
Upvotes: 13
Views: 9018
Reputation: 1
“selection change in a text box” If this means SelectedText changed than I needed to do this with a combo box. How: Created a MouseUp event which requires if selected text length > 0
Upvotes: -1
Reputation: 2813
You can use TextBox also.
Write a function GetMyPosition() and put in the events
When you want to notify the highlighting of a text, you also have to use
Upvotes: 5
Reputation: 11423
Well, I guess this may help! You will need to use RichTextBox still.
Upvotes: 1
Reputation: 156
You could use a RichTextBox and set Multiline to false. It has a OnSelectionChanged.
Upvotes: 4