winforms - How to display a particular tab from another form in vb.net -


i working on vb.net project in vs 2010 has multiple forms. have, lets say, form1 button , form2 tabcontrol.

how display particular tab(eg.tab2 or tab3) when user clicks on button form1.

to change selected tab of tabcontrol can use selecttab method or selectedindex property of tab control.

controls of form not accessible outside of form default. can let access control of form setting modifiers property of control public , generatemember property true.

so go designer of form2, select tab control, in properties window, set generatemember true , set modifier public. can access tab control form1:

dim f new form2() f.tabcontrol1.selectedindex = 1 'it selects second tab f.showdialog() 

note

in general design guideline it's better not expose forms controls. in such case it's better create property or method in form2 , use get/set selected tab of form2 form1. example can see munawar's answer.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -