I have created a new UserControl, that will be used for product and feature selection. It has a combobox and a numericUpDown control and as the users select a product from the combobox new instances of the usercontrol are nested into the control at runtime, to allow the user to select the features that are available for the selected product. I had originally created most of this functionality without the usercontrol, but found it very difficult to track the events properly. The problem right now, is that when I add the nested usercontrol the screen updates very slowly. If I add more of these UserControls to my form, it is very fast and if I use my logic to add the comboboxes and numericUpDown controls directly in the form, it is fast. Also removing the nested UserControls happens very fast as well. I have been unable to determine why the addition of the nested controls is taking so long. I have made sure that I am calling SuspendLayout on my panels before adding the new controls at runtime, but this does not seem to have any effect.
I am working on cleaning up some of the code to make create a test project that is easier to post, in the meantime, are there any general ideas of what might be causing this to be slow? I maybe should be specific about what I feel is slow. When I add controls, including a single instance of the UserControl, directly to the form, it seems to complete in under 1/4 second; barely noticable when working with the form. However, adding a single nested UserControl takes much closer to 1/2 second, which is noticable, but possibly acceptable. The problem is that it will be common to have to add 3-4 of these nested controls at a time and the time require seems to be linear; adding 3 controls takes over a second to complete. I don't think that this will be an acceptable delay for the application.
I am programming in VB.net on framework 3.5 using VS 2008 Professional, and answers in C# are acceptable, as I should be able to translate to VB.
Thanx in advance,