views:

399

answers:

2

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)?

+2  A: 

You could use a RichTextBox and set Multiline to false. It has a OnSelectionChanged.

Hamid
A great idea. Any disadvantages?
Vulcan Eager
I don't know from the top of my head. Might be you need a little tweaking to get it as dumb as a TextBox ;)
Hamid
+1  A: 

Well, I guess this may help! You will need to use RichTextBox still.

Galilyou