tabs - vb.net Setting tabcontrol to read-only -
i'm trying set tabcontrol1 read-only, reason not working me.
tabcontrol1.tabpages.isreadonly = true gives me error:
error 1 property 'isreadonly' 'readonly'. when try:
tabcontrol1.tabpages.readonly = true it gives me error:
error 1 'readonly' not member of 'system.windows.forms.tabcontrol.tabpagecollection'. whats wrong?
one option iterate on control's within tabcontrol tabpages , enable or disable controls. here's quick snippet done that. can choose to: disable/enable controls in tabpages or single tabpages if choose.
public shared sub enabledisablepages(byval tbcon tabcontrol, byval pg tabpage, byval enabled boolean) try 'single tabpage if pg isnot nothing each ctl control in pg.controls ctl.enabled = enabled next else 'all tabpages... if tbcon isnot nothing each tp tabpage in tbcon.tabpages each ccon control in tp.controls ccon.enabled = enabled next next end if end if catch ex exception 'handle exception... end try end sub this can used so...
enabledisablepages(tabcontrol1, nothing, false) 'disable tabpage controls. enabledisablepages(nothing, tabcontrol1.selectedtab, false) 'disable current tabpage. enabledisablepages(nothing, tabcontrol1.selectedtab, true) 'enable current selected tabpage. enabledisablepages(tabcontrol1, nothing, true) 'enable controls within tabpages. this tabpages controls not tabpage don't think wanting.
Comments
Post a Comment