c# - TabPage Validating event firing when clicked on the currently selected tab -


i'm doing things said in how prevent user changing selected tab page in tabcontrol?

things working fine. validating event of tabpage1 occurs if i've tabpage1 selected , user clicks on tabpage1 itself. , later when user clicks on tabpage2 validating event tabpage1 doesn't fire.

what happens if e.cancel in validating event of tabpage1, in above case, when user clicks on tabpage1 mistake having tabpage1 selected, prompt user "do want stay on current tab save data or move current tab?". , if user clicks stay doesn't changes. , when correctly clicks tabpage2, validating event of tabpage1 not firing.

i've uploaded sample application here. can run , see behavior understand problem

use tabcontrol.selecting event instead.

use this:

tabcontrol1.selecting += tabcontrol1_selecting;  private void tabcontrol1_selecting(object sender, tabcontrolcanceleventargs e) {     e.cancel = !(can switch tab); } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -