J
Jeff
I am inserting new TabPages to a TabControl, and I'm
having problems with the TabPage's contents not being
shown. I put two pages on the TabControl in the
constructor, and I have a button on the form that inserts
new TabPages. I am wanting to insert the new tab right
before the last tab. Here is the code:
//-----------------------------------------------------
TabPage all = tabControl1.TabPages
[tabControl1.TabPages.Count-1] ;
TabPage page = new TabPage
("Tab "+tabControl1.TabPages.Count-1) ;
bool selectLast = (tabControl1.TabPages.Count-1) ==
tabControl1.SelectedIndex ;
myusercontrol cont = new myusercontrol() ;
page.Controls.Add(i) ;
tabControl1.TabPages[tabControl1.TabPages.Count-1] = page ;
tabControl1.TabPages.Add(all) ;
if (selectLast)
tabControl1.SelectedIndex = tabControl1.TabPages.Count-1 ;
//-----------------------------------------------------
This code inserts the new TabPages appropriately, but the
contents of the new tabs aren't being shown. I tried to
capture the paint event of a button that is
on "myusercontrol", and it isn't firing. If I just add
the new tabs to the end (which I don't want to do) the
button is shown and the paint event fires.
Any clues?
having problems with the TabPage's contents not being
shown. I put two pages on the TabControl in the
constructor, and I have a button on the form that inserts
new TabPages. I am wanting to insert the new tab right
before the last tab. Here is the code:
//-----------------------------------------------------
TabPage all = tabControl1.TabPages
[tabControl1.TabPages.Count-1] ;
TabPage page = new TabPage
("Tab "+tabControl1.TabPages.Count-1) ;
bool selectLast = (tabControl1.TabPages.Count-1) ==
tabControl1.SelectedIndex ;
myusercontrol cont = new myusercontrol() ;
page.Controls.Add(i) ;
tabControl1.TabPages[tabControl1.TabPages.Count-1] = page ;
tabControl1.TabPages.Add(all) ;
if (selectLast)
tabControl1.SelectedIndex = tabControl1.TabPages.Count-1 ;
//-----------------------------------------------------
This code inserts the new TabPages appropriately, but the
contents of the new tabs aren't being shown. I tried to
capture the paint event of a button that is
on "myusercontrol", and it isn't firing. If I just add
the new tabs to the end (which I don't want to do) the
button is shown and the paint event fires.
Any clues?