Hi,
Is there any way to force the validating event to fire on a control prior to a tab switch so the tab switch can be cancelled? This is how a normal tab control works. We seem to be receiving the validating event after the tab switch occurs which is nasty if validation fails and message box opens. Also, if i open 2 tabs side by side using the grouping feature, I receive 2 validation events on the control losing focus when I select the other tab. If validation fails then focus remains in the control with invalid data but the other tab is selected. Is there anyway to get validation to work like a regular tab control, or turn validation off altogether?
Thanks,
Bill
In that case, you can call ValidateChildren on the ActiveMdiChild on the parent form. If it returns False, cancel the TabSelecting event.
Thanks Mike, I don't have control over what goes on in the validating event of every control in our system so I can't call activate. Do you know of a way to trigger the validating event during the TabSelecting event so I can cancel the tab change if the validation failed?
Thanks again,
This actually looks like a bug with the .NET Form. If you remove the UltraTabbedMdiManager, you can enter invalid input on one mdi child, then select another mdi child and the other mdi child will be selected before the Validating event is fired. The UltraTabbedMdiManager just controls the layout of Forms in the mdi parent and does not get involved in activation. You can work around this by by calling Activate() on the mdi child before showing your message box in the Validating event. Also, you can turn off validation by setting CausesValidation on the mdi child Forms to False.