I have a tab-control that has 4 tab pages. Each tab page contains a user-control that I add programmatically when the program first loads. For some reason the second tab-page loads slow when I click on it but the other tabs load fine. This tab-page does contain about 20 controls(text boxes, drop-downs, list boxes, etc) but no images or anything like that. Also that page has around the same number of controls as the others. Is there any way to speed up the switching of the tabs? Can I preload the tab-page at startup?
Note: It is only slow on the initial switch.
This is how I add the Usercontrol
tabPage2.Controls.Add(userControl_1);
//
// userControl_1
//
userControl_1.Anchor = ((AnchorStyles.Top | AnchorStyles.Bottom)
| AnchorStyles.Left)
| AnchorStyles.Right;
userControl_1.Location = new System.Drawing.Point(0, 0);
userControl_1.Name = "userControl_1";
userControl_1.Size = new System.Drawing.Size(878, 646);
userControl_1.TabIndex = 0;
This is a feature of the TabControl: The contents of a tab are only loaded when they are clicked for the first time.
It would therefore appear to be a problem of that UC on the 2nd Tabpage, look for the resources (queries) it uses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With