Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / December 2004

Tip: Looking for answers? Try searching our database.

Loading a form completely.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel Persson - 02 Dec 2004 14:55 GMT
Hi Everyone.

I have a pretty easy question but I can't solve it.

My code.

    myLoadingForm mLF = new myLoadingForm();
    mLF->Show();
    /* Process Data */
    mLF->Hide();
   

My problem is that I want to show this form and load it completely before i
start to process my data. This form show a text what I'm doing atm and also a
progress bar that i update during my processing and an animated gif so that
the user could see that the application is working.

But the animation and the text telling the user what is going on never loads
except when my process is done but then its already to late. How do I load
the form and all it's object before I start to process my data?

Best regards

Daniel Persson
Tamas Demjen - 08 Dec 2004 21:46 GMT
> My problem is that I want to show this form and load it completely before i
> start to process my data. This form show a text what I'm doing atm and also a
[quoted text clipped - 4 lines]
> except when my process is done but then its already to late. How do I load
> the form and all it's object before I start to process my data?

You have to use threads, or call into Application->DoEvents
periodically. That's because while you are processing your data, the GUI
is not responding. Try something like this:

while(your_loop)
{
   do_fraction_of_your_processing();
   Application->DoEvents();
}

See http://tinyurl.com/5zul4 for a complete example.

I also recommend that you consider putting your processing into a
thread. It has better performance, as DoEvents() has quite a bit of
overhead, and it's hard to guess how frequently it should be called.

Tom

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.