Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Help display ProgressBar while ChildForm loads

Reply
 
Old 02-10-2009   #1 (permalink)
Viking2000


 
 

Help display ProgressBar while ChildForm loads

Hi I hope I have the right group for this.
I have an MDI form, and some of the child forms take awhile to load
because they are data heavy. I want to display a Progressbar so that
the user has an idea that something is still happening. I know the
average time for loading for each form, so I can make the ProgressBar
fairly accurate. Also each child form can be written by a different
group so I need to keep the amount of special code they implement to a
minimum,
I know this requires threading but I am running into some issues.
1) Loading the Child Form in the main thread, calling ProgressBar
update in another thread. It appears that all screen updates only
happen in the main thread, so all the screen updates get queued, until
the form is completed, so this does not give any useful display.
2) Load the child form in another thread, keeping the main thread
unencumbered to do things like screen updates. This works pretty well
except that I can not attach the child form to the MWI Parent because
it is owned by a different thread at this point.
So my problem is the child form must load in the main thread, all
screen updates must happen in the main thread. How do I interrupt the
main thread while loading so that I can force screen updates? Or am I
taking the wrong path, and is there another method I should be looking
into?

Thank you

My System SpecsSystem Spec
Old 02-11-2009   #2 (permalink)
Cor Ligthert[MVP]


 
 

Re: Help display ProgressBar while ChildForm loads

Viking,

Your first problem is, that a progresbar assumes that you have a begin and
an end, I don't see what is that in your question.

Do it likes Microsoft does mostly, simple show an AVI.

By the way, although this is a developper newsgroup is your question highly
program language depended (VB has some extras too make multhithreading
easier).

Therefore you are probably better of in one of the language newsgroups which
you are using.

Cor


"Viking2000" <jeremy.kloss@xxxxxx> wrote in message
news:aae52aa1-61c7-4c8e-8b87-39e41d84994e@xxxxxx
Quote:

> Hi I hope I have the right group for this.
> I have an MDI form, and some of the child forms take awhile to load
> because they are data heavy. I want to display a Progressbar so that
> the user has an idea that something is still happening. I know the
> average time for loading for each form, so I can make the ProgressBar
> fairly accurate. Also each child form can be written by a different
> group so I need to keep the amount of special code they implement to a
> minimum,
> I know this requires threading but I am running into some issues.
> 1) Loading the Child Form in the main thread, calling ProgressBar
> update in another thread. It appears that all screen updates only
> happen in the main thread, so all the screen updates get queued, until
> the form is completed, so this does not give any useful display.
> 2) Load the child form in another thread, keeping the main thread
> unencumbered to do things like screen updates. This works pretty well
> except that I can not attach the child form to the MWI Parent because
> it is owned by a different thread at this point.
> So my problem is the child form must load in the main thread, all
> screen updates must happen in the main thread. How do I interrupt the
> main thread while loading so that I can force screen updates? Or am I
> taking the wrong path, and is there another method I should be looking
> into?
>
> Thank you
My System SpecsSystem Spec
Old 02-12-2009   #3 (permalink)
Morten Wennevik [C# MVP]


 
 

RE: Help display ProgressBar while ChildForm loads


"Viking2000" wrote:
Quote:

> Hi I hope I have the right group for this.
> I have an MDI form, and some of the child forms take awhile to load
> because they are data heavy. I want to display a Progressbar so that
> the user has an idea that something is still happening. I know the
> average time for loading for each form, so I can make the ProgressBar
> fairly accurate. Also each child form can be written by a different
> group so I need to keep the amount of special code they implement to a
> minimum,
> I know this requires threading but I am running into some issues.
> 1) Loading the Child Form in the main thread, calling ProgressBar
> update in another thread. It appears that all screen updates only
> happen in the main thread, so all the screen updates get queued, until
> the form is completed, so this does not give any useful display.
> 2) Load the child form in another thread, keeping the main thread
> unencumbered to do things like screen updates. This works pretty well
> except that I can not attach the child form to the MWI Parent because
> it is owned by a different thread at this point.
> So my problem is the child form must load in the main thread, all
> screen updates must happen in the main thread. How do I interrupt the
> main thread while loading so that I can force screen updates? Or am I
> taking the wrong path, and is there another method I should be looking
> into?
>
> Thank you
>
3)

Load the Child Form normally, but do not perform heavy initialization during
load. Put an all covering panel in front of all controls (or just hide or
disable everything) and display a progress bar on the panel or in an
otherwise suitable place. Have the Child Control do the heavy initialization
in a separate thread (BackgroundWorker) and hide the panel/show everything
else when the initialization is done.

As Cor said, you are better off in a language specific group as the general
group attracts loads of off topic posts to such a degree that relevant posts
often drown.

--
Happy Coding!
Morten Wennevik [C# MVP]

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
IE7 Loads Slowly Network & Sharing
Maximum property of ProgressBar .NET General
FS 2004 ALMOST loads.. not quite! Vista General
AOL loads, but then exits Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46