![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 > 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 Specs![]() |
![]() |
| 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 | |||