views:

154

answers:

2

I have a C# Windows Forms app.

I have a TabControl on it, and depending on user settings, will dynamically use TabControl.Controls.Add to add a specific set of TabPages to the tabs. The TabPages aren't special, they just have buttons and text.

Doing this dynamically, even for small amount of tabs, is slow as hell. Every "Add" call, or using "AddRange" to add a bunch at once results in a half second or so of waiting.

SuspendLayout has no effect.

Any suggestions?

A: 

Try tabcontrol.Enabled = False while you add, then True when done.

Martin
A: 

It wasn't the add control, it was one that one of my control has a PropertyGrid on it, and the Form_Load sets the SelectedObject, which is the slow operation.

PropertyGrid being slow is a different question!

XPav