M
maksim.yevstratov
Hi,
I have a UserControl with a TextBox in it. TextBox has Validating event
handler that can cancel the validation. If I place two UserControls
like this on a form then Validating event will be firing twice. To
demostrate this I put the following code inside the UserControl.
private int count = 0;
private void textBox1_Validating(object sender, CancelEventArgs
e)
{
e.Cancel = true;
textBox1.Text = (count++).ToString();
}
I can see then the couter growing by 2 every time I try to change focus
from one user control to another.
The behavior is the same in VS.NET2003 and VS2005.
Can anybody explain why it's happening and what could be a fix or
workaround?
Thanks
I have a UserControl with a TextBox in it. TextBox has Validating event
handler that can cancel the validation. If I place two UserControls
like this on a form then Validating event will be firing twice. To
demostrate this I put the following code inside the UserControl.
private int count = 0;
private void textBox1_Validating(object sender, CancelEventArgs
e)
{
e.Cancel = true;
textBox1.Text = (count++).ToString();
}
I can see then the couter growing by 2 every time I try to change focus
from one user control to another.
The behavior is the same in VS.NET2003 and VS2005.
Can anybody explain why it's happening and what could be a fix or
workaround?
Thanks