2 Replies - 4086 Views - Last Post: 12 October 2011 - 08:32 AM

#1 Guest_gumby*


Reputation:

User Control

Posted 19 December 2010 - 05:28 PM

I have a design question.

Sometimes I create user controls to create screen panels, not for reuse, but to separate one panel's code from others'. For instance, if i'm designing an application that uses a tab layout with several controls on the tab page, i'll create a user control and dock it on the tab page. I've ran into problems in the past when my screens do a lot of deserializing on load. When you add the user control to the screen designer in VS 2008, it seems to go through the load event when it displays the control on the main form. This will sometimes cause lag on my dev machine.

I'm writing an app now with a db backend and when these usercontrols load I need them to connect to a db, fire off some queries and populate the controls. I don't want to run into the same issue with a laggie designer once I place these on the main form. Am I using User Controls for the wrong purpose? Is there a more suitable template to use in VS 2008?

Is This A Good Question/Topic? 0

Replies To: User Control

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1055
  • View blog
  • Posts: 4,087
  • Joined: 02-July 08

Re: User Control

Posted 19 December 2010 - 07:41 PM

Not really, anything that has a delay in processing data will slow down the UI. If you load the UC's in the main form's load event the form stays hidden til this event is complete. This is how I load my UC's whenever possible. Threading is an option, I think it may speed it up if more things can happen at the same time.
Was This Post Helpful? 0
  • +
  • -

#3 jonkettle  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 12-October 11

Re: User Control

Posted 12 October 2011 - 08:32 AM

The heavy processing happening on the usercontrols should be done on a seperate thread so as not to hinder the main interface. Just overlay the user control with a nice animated gif depicting something is happening when the thread is executing and processing and when the thread has completed its code execution it can hide that gif.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1