hatman
Well-known Member
- Joined
- Apr 8, 2005
- Messages
- 2,664
I have a userform with 18 Frame Controls and 3 CommandButtons that have been placed at design-time. In each of two of these Frame Controls I have placed a ListBox control (the controls for the other 16 frames get created at runtime). These 2 listboxes get populated in teh initialize event of teh userform. Pretty simple so far. So on my machine, the form loads in well under 100 ms. On the big-screen monitors on the manufacturing floor, this form takes over 1 second to load. Long enough for people to wonder if they really pressed the button or not. At first, I thought the time was being spent in the intialize event. After optimizing the code with almost no gain, I commented out the entire event. This led me to start commenting out all code that manipulated the userform controls. What I was left with was the conclusion that creating the new object and displaying it was taking all of the time... over 1 second. I started removing controls from the userform, and eventually found I could load the form on the big screen display in well under 100 ms if I loaded it without and controls on it.
Here's where it gets bizarre. As part of it's normal operation, every time the user selects a new member of one of teh (2) list boxes, all of the controls in the other 16 frame controls get deleted, and then 16 new controls get built as either ComboBoxes or TextBoxes, depending upon the configuration data that is retrieved from an external Access Database. This event takes well under 50ms to execute.
I am left with the conclusion that I should be building ALL of the controls on the userform at runtime. Does this seem right? Can anyone explain why this would be the case?
Here's where it gets bizarre. As part of it's normal operation, every time the user selects a new member of one of teh (2) list boxes, all of the controls in the other 16 frame controls get deleted, and then 16 new controls get built as either ComboBoxes or TextBoxes, depending upon the configuration data that is retrieved from an external Access Database. This event takes well under 50ms to execute.
I am left with the conclusion that I should be building ALL of the controls on the userform at runtime. Does this seem right? Can anyone explain why this would be the case?