Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

947 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

22 Experts available now in Live!

Get 1:1 Help Now