c# - Disabling other tabs when clicked on a button -
i disable tab selection when clicking on button. using following code:
foreach (tabpage page in scenarioselectiontab.tabpages) { if (scenarioselectiontab.selectedtab != page) page.enabled = false; }
the problem is, when use code above, disables current tab well. how can prevent it?
try variant:
foreach (tabpage page in scenarioselectiontab.tabpages) { ((control)page).enabled = scenarioselectiontab.selectedtab == page; }
tabpage class don't have working enabled property. read msdn.
if don't work, try variant selected event:
private void tabcontrol1_selecting(object sender, tabcontrolcanceleventargs e) { if (e.tabpage != scenarioselectiontab.selectedtab) e.cancel = true; }
Comments
Post a Comment