Hi group, I have a TabPanel with 2 tabs, so index 0 and 1.
Now I would like to make that when I press a button, the first one with its focus is shown, and when I press another button, the second one is seen with its focus. I wrote this.
…
if I press button 1 the right window starts.
if I press button 2 the right window starts.
But if I press 1 and then 2, or 2 and then 1, I get an error. Where am I wrong?
Well first of all, don’t remove the panels. they automatically hide when another panel is shown, and you can get rid of the calls to make it visible unless it’s truly hidden.
Yes, now I was trying to eliminate the TabPanel1.RemovePanelAt(1) code, and it works, the panel is selected automatically and it doesn’t give me an error when changing. But can I hide the unused panel with a method other than TabPanel1.RemovePanelAt(1) ?
As Greg mentioned, panels and controls automatically hide when you switch visible panels. Anything that’s still shown after you change the SelectedPanelIndex isn’t actually on the panel.