Each Control in a separate thread

Hello,

I am creating a form that contain alot of usercontrols, these user controls is heavy and contain a lot things do,
I want to know a way how to :
When loading the form each control run in a separate thread.

I use some code like that to load the controls:
Dim ctrl1 as new MyUserControlType
Dim ctrl2 as new MyUserControlType
Dim ctrl3 as new MyUserControlType

form.Controls.Add(ctrl1)
form.Controls.Add(ctrl2)
form.Controls.Add(ctrl3)

Please help,

Thanks,
LVL 1
amrelgarhy81Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Controls run in the same thread as the form that contains them...

Did you create the UserControls?  You can make the code INSIDE the UserControls run in a seperate thread.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gregoryyoungCommented:
"Did you create the UserControls?  You can make the code INSIDE the UserControls run in a seperate thread."

Even if you create threads inside of the various controls to handle their tasks it really depends what they are doing as to whether or not there will be a gain. Even if you have multiple threads running in these controls those threads still have to broker any changes to the controls back to the main thread (only the thread that creates a control can access it) as such if your controls are spending their time updating their visual representation even adding additional threads within the controls will not help.
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
This is true.  =)

It all depends on what we're doing here...

Can you gives us more details about the UserControl amrelgarhy81?

Along with a bigger picture of the application?
amrelgarhy81Author Commented:
Hello,

The application is a small designer application for windows application, and use some user controls i made for it like:
Scroll Image Control (Load in it number of images to move one after one in run time)
Custom PictureBox control (Load in it number of images to move one after one in run time)
Windows media control (playing medias)
When loading the .exe file that the design create the controls run slow on the form and very slow when loading and closing.
I thought that running each control in a separate thread  may solve this porformance shortening.
Notes:
In these controls like the Scroll Image Control i use a timer to slide the images while running.


thanks,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.