Link to home
Start Free TrialLog in
Avatar of ElrondCT
ElrondCTFlag for United States of America

asked on

Blank TabControl after removing TabPage

I have a TabControl in a Windows Forms app (VB 2008). Some of the tabs aren't used for certain versions of my app. I use conditional compilation to .Remove those that won't be used, which has worked fine.

However, I'm creating a new version which doesn't need to display the first TabPage of the TabControl, and I'm running into a problem. I have specified a new page for index=0, but now when the application starts, the TabControl is always completely blank. If I click on one of the tabs, a proper page displays.

What is blanking the control, and how do I overcome that?
ASKER CERTIFIED SOLUTION
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you can't find it, do something like

tabcontrol1.tabs(0).visible = true
inside the form load
Avatar of ElrondCT

ASKER

I am intentionally doing a .Remove of the first tab (in the Form Load event handler). However, your mention of .Visible caused me to trace what was happening with that property on my desired tab (even though it's not normally listed as a property of the TabPage). It turned out that I was trying to select the original first tab, even though it had been removed, which turned off the .Visible property of the tab I wanted to display. Eliminating the spurious selection keeps my desired tab visible.
Glad i helped you find the problem