Reputation: 3
I have text box with leave event
private void textBox1_Leave(object sender, EventArgs e)
{
MessageBox.Show("Leave");
}
and button with click event
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Click");
}
When I enter text in textbox and click the button the leave event fires but click event does not.
How do I fire the click event without invoking button1_Click
in the leave event?
Upvotes: 0
Views: 1700
Reputation: 14059
Simply replace MessageBox.Show
with Console.WriteLine
in the textBox1_Leave
and you will see the button's click event.
In other words, it seems that user interaction in the Leave
event breaks events chain, because of the focus was captured by MessageBox
.
Upvotes: 2