C control on validating
For certain control, once it has focus, it will validate its data for closing, leaving, etc.. So the only problem when changing pages is when all the child controls on the form have no focus, then swith pages will not trigger the child controls' validating events.For this issue, I think there are 2 workarounds: 1.Hi Dennis, Based on my understanding, you want to validating all the controls on the tabpage before switch pages.I think you should hook the Validating event for all the controls on your form.
Selected Index Changed event, you can explicit invoke all the validating event handler, if not valid, then swith back to the orignal tabpage.
Event Args e) bool b_switch=false; private void button1_Click(object sender, System.
Event Args e) Thank you for your patience and cooperation.
Thanks, Dennis Hi, Dennis did you try to hook Tab Page. Selected Index Changed event, you can explicit invoke all the validating event handler, if not valid, then swith back to the orignal tabpage.
Ideally, I think the best solution is not to leave a tab until the validating event has completed successfully. Being able to do that might help for my particular circumstances. If you have multi-tab entry form final validation should occur only when final tab page is filled and confirmed. I guess maybe I should have asked only how to prevent a user from leaving a tab page. I think you should hook the Validating event for all the controls on your form.