Solved

Need Help Speeding Load Time of Programmatically Created Controls in VB.NET PC Application

Posted on 2011-09-13
5
331 Views
Last Modified: 2012-05-12
Hello,

I am developing a VB PC application using Visual Studio 2008 and the .NET 3.5 Framework.

In debug mode, my code loads programmaticlly created controls very slowly, but this is OK.  The problem is that when I run in release mode, the system is no faster.

I'm wondering if there is some setting(s) I need to change for the release mode configuration (i.e., maybe release mode is accidentally configured like debug mode in one or more ways that need to be altered).

Any help would be most appreciated.

Thank you, Stu Engelman
0
Comment
Question by:stuengelman
  • 3
5 Comments
 
LVL 17

Expert Comment

by:nepaluz
ID: 36528521
Can you show us some code of how you create the controls? Unless you are creating hundreds of thousands, speed should not be an issue, rather memory usage should.
0
 

Author Comment

by:stuengelman
ID: 36528667
Hi Nepaluz,

In most cases I am loading multiple instances of progammatically instantiated User Controls.  The User Controls contain the native controls, such as text boxes, checkboxes, and buttons.  The typical User Control has about ten native controls.  The render speed is very slow, even if only 5-6 User Controls need to be rendered on my form.

Sample instantiation code is:

Dim dmxrow As New MXrow ' 'MXrow is the name of the User Control here
dmxrow.Name = "mxrow" & CStr(ii) 'ii is a counter
Me.Controls.Add(dmxrow)
dmxrow.Left = 40
dmxrow.Top = toplevel 'toplevel is serially updated so the controls are rendered vertically

Stu
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36529254
Is there code that could be optimized in the UserControl constructor, Load event or VisibleChanged?

You also try to suspend the layout while loading your controls. This might help a bit:
Me.SuspendLayout()
'Load your controls
Me.ResumeLayout()
Me.PerformLayout()

Open in new window

0
 

Author Comment

by:stuengelman
ID: 36529446
James - FANTASTIC!  It's 100 times faster.

Thanks so much, Stu
0
 

Author Closing Comment

by:stuengelman
ID: 36529452
Great job, solution worked perfectly.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now