My CustomControl is created with TextBox and ComboBox. And i want to use Validating event for this control. But if i use innerTextBox.Validating this means that will work for TetBox which is ok. But i do not want that this event will fire when i will click on ComboBox which is also part of this UserControl. I want that this UC will be as one. So i can click on TextBox and Combobox and no event will fire becouse they are one together…
innerTextBox is TextBox
innereComboBox is ComboBox
this is my code code event for Validating. What to do that event will not fire when i click on ComboBox?
public new event System.ComponentModel.CancelEventHandler Validating
{
add
{
innerTextBox.Validating += value;
}
remove { innerTextBox.Validating -= value; }
}
Hope you understand my problem.
I think you have to do this yourself. Turn off the
CausesValidationproperty for your inner controls so they DON’T fire, and then run your validating code for the UserControl:For example, this control requires a non-empty TextBox and a selected item from the ComboBox: