Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2005 with .NET 3.0 Programmer's Reference ISBN: 978-0-470-13705-5
This is the forum to discuss the Wrox book Visual Basic 2005 with .NET 3.0 Programmer's Reference by Rod Stephens; ISBN: 9780470137055
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2005 with .NET 3.0 Programmer's Reference ISBN: 978-0-470-13705-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old March 17th, 2008, 06:53 AM
Authorized User
Join Date: Dec 2006
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form load events

How can I get a form to paint before the Load event is compelete?

My form does some rather long processing as part of its load process. Currently some of the form's controls are partially painted and the form looks terrible! I've moved the processing to the Activated event but it didn't really help. I need some sort of "paint it now" method in the Load event.

Any ideas?


Reply With Quote
  #2 (permalink)  
Old March 17th, 2008, 10:03 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,149, Level: 23
Points: 3,149, Level: 23 Points: 3,149, Level: 23 Points: 3,149, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 642
Thanks: 2
Thanked 96 Times in 95 Posts

There's no really great way to do this. If it's one-time initialization, you might consider displaying a splash screen and then running the code. Or you could start the long process from a timer on the main form after giving it a second or two to display.

No matter what, however, there will be times when a long calculation will freeze interface drawing so the user may see a half-drawn screen... unless you run the long calculations in a separate thread.

So probably the best solution for one-time initialization is to (1) display a splash screen, (2) start a thread or BackgroundWorker to perform your long initialization, (3) when the thread or BackgroundWorker completes, it should close the splash screen and start the main form.


Rod Stephens, Visual Basic MVP

*** New Book ***
"Visual Basic 2008 Programmer's Reference"

Sign up for the free VB Helper Newsletters at http://www.vb-helper.com/newsletter.html
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
The MDIChild Form does not load Dhirendra ADO.NET 1 September 23rd, 2006 12:01 PM
Form events pavel VB How-To 3 April 22nd, 2004 07:06 AM
"Delete Events" in Form Do Not Execute tcarnahan Access VBA 3 November 12th, 2003 09:06 PM
capturing form closed events alexferrie C# 2 June 17th, 2003 10:53 AM

All times are GMT -4. The time now is 11:56 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.