C control on validating Twoway web cam chat xxx
In this example I am implementing an generic validation rule that takes a regular expression as validation rule. If the expression matches the data is treated as valid. The problem I am experiencing is when a control fails its validating event and the user clicks another tab things get messy. I guess maybe I should have asked only how to prevent a user from leaving a tab page. You can combine this with Validating event, where you can set Cancel=true to prevent further events after Validating. Generally speaking, I would suggest to reconsider whole validation scheme you use now - whatever unusual things you are trying to do. Ideally, I think the Hi Dennis, Based on my understanding, you want to validating all the controls on the tabpage before switch pages. Drumm" Is there a way to prevent the user from leaving a tab on a Tab Control until all the controls on that tab have finished validating? Ideally, I think the Dennis, I expect that while you are executing code in Leave event your other page cannot receive focus (even if can, there will be no interaction possible if you don't call App. Hence, if your validation in Leave fails you can always go back to original page and select / focus corresponding control. The problem I am experiencing is when a control fails its validating event and the user clicks another tab things get messy.Event Args e) bool b_switch=false; private void button1_Click(object sender, System.Event Args e) Thank you for your patience and cooperation.
I think you should hook the Validating event for all the controls on your form.
loop all the controls on the tabpage, then judge if each control is the default value(We suspect the default value is not the valid value), if it is the default value, does not allow the index change. You may add a custom validating type event for each tabpage, then when registering event handler for child control's Validating event, you should also register it for the tabpage custom event, then in Tab Control.
Selected Index Changed event, you can explicit invoke all the validating event handler, if not valid, then swith back to the orignal tabpage.
Is there any way I can disable this validation errors on controls till user tries to submit the form? Error Content, you can add , Binds Directly To Source="True" and it will always show the first error and won't "lie to you" about errors that have already been corrected.
Except that the error will not necessarily be correct if there's more than one error. Alternatively, you could replace your Validation Tool Tip Template with the following: Thanks for your nice tutorial.