TabPage Validating event firing when clicked on the currently selected tab

Posted by Ismail S on Stack Overflow See other posts from Stack Overflow or by Ismail S
Published on 2010-04-28T11:27:50Z Indexed on 2010/04/28 11:33 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

I'm doing things as said in How do I prevent the user from changing the selected tab page in a TabControl?

Things are working fine. But the validating event of tabpage1 occurs if I've tabpage1 is currently selected and user clicks on tabpage1 itself. and later when user clicks on tabpage2 validating event for tabpage1 doesn't fire.

What happens is if I do e.Cancel in validating event of tabpage1, in the above case, when user clicks on tabpage1 by mistake having tabpage1 already selected, it will prompt user that "Do you want to stay on current tab to save data or move from the current tab?". and if user clicks Stay but doesn't do any changes. And then when he correctly clicks tabpage2, Validating event of tabpage1 is not firing.

I've uploaded the sample application here. You can run and see the behavior to properly understand the problem

© Stack Overflow or respective owner

Related posts about tabpage

Related posts about tabcontrol