Tess_H

Hello,

Any advice or suggestions are appreciated!
I'm trying to change the selected tabPage in a tabControl in a second form depending on an option chosen in the main form.

So far, I have this in the main form (and tabControlDetail is on the frmDetail form):

frmDetail myForm = new frmDetail();

myForm.SelectNextControl(TabPage);

... I know--not much. The tabControl.tabPage property doesn't appear in anything I've tried so far.
I'd like to do something like:

myForm.tabControlDetail.SelectedTabPage(1)

where 1 (or n) is the selected tabPage.

Thanks for any advice,

Tess




Re: Windows Forms General Change second form's selected tabPage in tabControl

James Curran

You do NOT set it in the main form. You tell the detail form to set it's own tab:



frmDetail myForm = new frmDetail(nTabToSelect);
// :
// :
class frmDetail
{
public frmDetail(int nTab)
{

InitializeComponent();
this.tabControlDetail.SelectedTabPage(nTab)

}
}






Re: Windows Forms General Change second form's selected tabPage in tabControl

Tess_H

Thanks very much!

I modified your suggestion slightly to:

this.tabControlDetail.SelectTab(sTab);

 

and it works great!

Cheers,
Tess