Reputation: 13
is there an event for when the contents of a text box have been highlighted.
If not is there a way to determine this.
Also is there a way to determine of a text box has been tabbed to.
Thanks,
Upvotes: 1
Views: 1119
Reputation: 25695
You will have to mix a few events for this.
Upvotes: 0
Reputation: 65069
There is no event for highlighting.. but you can simulate it via the MouseUp
and KeyUp
events:
private void textBox_MouseUp(object sender, MouseEventArgs e) {
if (textBox.SelectedText != "")
MessageBox.Show("Selected!");
}
private void textBox_KeyUp(object sender, KeyEventArgs e) {
if (textBox.SelectedText != "")
MessageBox.Show("Selected!");
}
There is also an Enter
event for when the TextBox gains focus.
Upvotes: 3