Changing Tab Pages

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I have a page with 2 Tabbed Pages on them (TabPage1, TabPage2).

I am on TabPage1 and when selecting something on the page I am displaying
information on TabPage2 and then want to go to TabPage2, but it doesn't
work.

I tried:

EmailFrom.Text = ds.Tables("Emails").Rows(row)("from_address")
EmailTo.Text = ds.Tables("Emails").Rows(row)("to_addresses")
CC.Text = ds.Tables("Emails").Rows(row)("cc_addresses")
BCC.Text = ds.Tables("Emails").Rows(row)("bcc_addresses")
Subject.Text = ds.Tables("Emails").Rows(row)("subject")
Body.Text = ds.Tables("Emails").Rows(row)("body")
TabPage1.SendToBack()

and also TabPage1.Visible = False but neither worked.

How do I get TabPage2 to display programmatically?

It works fine if I select the tab manually but I want it to automatically
display the tabbed page after the data is put on the page.

Thanks,

Tom
 
This is what I found on a website on how to do this:
*****************************************
Getting and Setting Active Tab Programmaticall

You can get and set an active tab of a TabControl programmatically using the
SelectedTab property of TabControl. For example, the following code snippet
sets PreferencePage as active tab:

this.tabControl1.SelectedTab = this.PreferencesPage;
*********************************************

I tried this:

EmailDataGrid.TableStyles.Add(dgStyle)
EmailDataGrid.DataSource = ds.Tables("Emails")
EmailDataGrid.ReadOnly = True
TabControl1.SelectedTab = TabPage1

But it doesn't do anything. I am doing this. After filling the DataGrid, I
am setting the TabContol1 to the TabPage1 page.

Is there something else I need to do to get this to work?

Thanks,

Tom
 
Got it to work.

The problem had to do with it going to the SelectedIndexChanged event of my
ComboBox at the start of the program.

Both TabControl1.SelectedTab and TabControl1.SelectedIndex worked fine.

Tom
 
Back
Top