Solved

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

Posted on 2011-09-13
5
333 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

831 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