Using Forms and TabPages

johnadonaldson

Well-known member
Joined
Nov 9, 2005
Messages
48
Programming Experience
10+
I am setting up TabPages and want to display and lock a form onto a
TabPage screen area. That is when I select a TabPage, I want to display a pre-defined Form on that TabPage. I know how to set the start positon for the Form but how do I lock it in place, so that if I move the Application around it moves in relation.

I hope I am explaining correctly what I want to do.
 
I beleive I understand what you mean, but I can't think of a reason you would do that. Why not just add the same controls that are on the form to the tabPage?
If you are trying to keep the different tabPage contents seperate from the main form, you could create a UserControl and add that to the tabPage.
 
Let me see if I can explain what I want to do a little better. I am building a application that will load in different configurations based on a menu. Each entry will represent a different card configuration. So if I select card A, B, D
I want the respective configuration data to appear on Tab Page 1,2,3. If I select card C,D,E then I want Tab Page 1,2,3 to represent the new configuration.

I was thinking of having each configuration on seperate FORMS. This would allow me to make changes easier.
 
A UserControl is what you need. UserControls have many of the same properties/methods as Forms but are meant to be contained in other controls.
 
Additionally: if you already have the forms created, you can convert them to usercontrols by changing the Inherits statement that immediately follows the class declaration. You may also have to remove the AutoScaleBaseSize property from the InitializeComponent procedure as the UserControl does not contain that property.
 
Thank you. This excatly what I was looking for. It even puts the show command in the TabX_Click routine, so I can load different user controls depending on how I want to configure the screen.
 
Back
Top