I'm looking for a method to get the value for a selected word from textbox.
For example:
I have textbox.Text =" How are you";
when I select "are" I should get message with selected word MessegeBox.Show(selectedWord);
The Windows Forms TextBox control has a SelectedText property which will return the selected portion of the TextBox's value.
http://msdn.microsoft.com/en-us/library/aa288415%28VS.71%29.aspx
Windows Forms TextBox doesn't have a SelectionChanged event, although the RichTextBox control does. You could use a variety of hacks such as a timer, handling mouse up and key up events to trigger your selection change logic. Then use the SelectedText as others have suggested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With