473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Form Load -> show form... then do stuff

Right now I have a vb.net windows form project that does a whole bunch of
things on the form.load event. The problem with this is that the user does
not see the form until all the those things are done.

Is there a way for a form to be shown first AND THEN have it automatically
start to run through my code? (perhaps a different event??? form.paint,
form.activate)

Right now... the form is running but the user can't see it, and so they end
up clicking on the application to run again and the user thinks the program
is slow... AND WE CAN'T HAVE THAT!!!! :)

I would like:
Basically the form would load
i would have a status bar that says "loading data"... and then the form
would then show the data once it's loaded

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com
Nov 21 '05 #1
7 1922
Don
I've come across the same issue in my program. My solution was to add a
timer to the form that is started at the last possible moment in the
Form.Load event. This timer lasts only one millisecond. When the timer's
Tick event fires, it calls a sub I called DelayedFormLoad. Code put in this
sub is executed immediately after the form becomes visible.

What I actually did was a little different from what I described above (I
just wanted to keep the initial explanation simple). I actually put all
this code in a base form from which all my other forms inherit. This base
form would raise a DelayedFormLoad event when the timer ticks off one
millisecond after the Form.Load event instead of just calling a sub. This
provides all child forms with a DelayedFormLoad event which can be handled
just like the Load event in my other forms.

- Don
Nov 21 '05 #2
On 31/08/2005 Chris Thunell wrote:
I would like:
Basically the form would load
i would have a status bar that says "loading data"... and then the
form would then show the data once it's loaded

Use a global boolean variable called something like m_blnActivated, set
it to false, then put all your stuff in the Form Activate event but
only run it if m_blnActivated is false. After the first run set
m_blnActivated to true so it doesn't run again.

I have just used this technique in an app where I had the same issue as
you.

--
Jeff Gaines
Nov 21 '05 #3
Chris,

You can replace all your not real formloading code to the form_activated
event and than set in it

\\\
static done as boolean
if not done then
....
....
done = true
end if
///

I hope this helps,

Cor
Nov 21 '05 #4
Hi Chris,
How are you doing?

I would suggest you to start your project with a form with a progress or
some message informing the users that the application is loading
and in this form put up the code for loading your real form. When the real
form has completed loading you may place the first startup form
to hide/unload in the real form's activate event.

I hope this is helpful.
Thanks
Mona
[Grapecity]

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:Oa**************@TK2MSFTNGP09.phx.gbl...
Right now I have a vb.net windows form project that does a whole bunch of
things on the form.load event. The problem with this is that the user does not see the form until all the those things are done.

Is there a way for a form to be shown first AND THEN have it automatically
start to run through my code? (perhaps a different event??? form.paint,
form.activate)

Right now... the form is running but the user can't see it, and so they end up clicking on the application to run again and the user thinks the program is slow... AND WE CAN'T HAVE THAT!!!! :)

I would like:
Basically the form would load
i would have a status bar that says "loading data"... and then the form
would then show the data once it's loaded

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com

Nov 21 '05 #5

I think the best way is to put a timer control on a form. so when form is
loaded, timer control will start and put your codes there.
you can set any timerinterval for that timer which in my perspective is the
best solution for your question.

"Mona" <mo**@discussions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Chris,
How are you doing?

I would suggest you to start your project with a form with a progress or
some message informing the users that the application is loading
and in this form put up the code for loading your real form. When the real
form has completed loading you may place the first startup form
to hide/unload in the real form's activate event.

I hope this is helpful.
Thanks
Mona
[Grapecity]

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:Oa**************@TK2MSFTNGP09.phx.gbl...
Right now I have a vb.net windows form project that does a whole bunch of
things on the form.load event. The problem with this is that the user

does
not see the form until all the those things are done.

Is there a way for a form to be shown first AND THEN have it
automatically
start to run through my code? (perhaps a different event??? form.paint,
form.activate)

Right now... the form is running but the user can't see it, and so they

end
up clicking on the application to run again and the user thinks the

program
is slow... AND WE CAN'T HAVE THAT!!!! :)

I would like:
Basically the form would load
i would have a status bar that says "loading data"... and then the form
would then show the data once it's loaded

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com


Nov 21 '05 #6
Do you want your users to be able to interact with the form once it is
shown? If so, then you might want to look at spawning a new thread to
perform the long running process.

If the users should *not* interact with the form until after the
loading process has completed, then use one of the techniques posted by
other users but show a splash form to indicate that the program is
still loading.

Nov 21 '05 #7
To simply show the form before other processes run, I use this:
Me.Show()
Me.Refresh()
Application.DoEvents()

To indicate the form isn't yet ready for use, I prefer some kind of
status message combined with an hourglass.
sbpStatusBar_MessagePanel.Text = "Loading..."
Me.Cursor = Windows.Forms.Cursors.WaitCursor

Of course, to be certain these appear to the user, place them before
the Refresh() call.

HTH

Jeff J.

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: robert walker | last post by:
hi all, to my webapp named mrf, i have added load-on-startup tag to mrf\WEB-INF\web.xml so i added a snippet like so <servlet> <servlet-name>loadDbProperties</servlet-name>...
1
by: Ray in HK | last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE ? I found some web hosting company do not allow using LOAD DATA INFILE but allow LOAD DATA LOCAL INFILE. The reason...
6
by: JS | last post by:
EE instance DB2 v7.2.0 fixpack 3 on WIN2K. I select some data from a table A and write it to a file using the COALESCE function and whitespace as the null character: eg coalesce(col1, ' '). This...
3
by: Prince Kumar | last post by:
When running LOAD with "ALLOW READ ACCESS", I get the following error if select is running againt the table (isolation UR). load.sql --------- db2 load from /u02/data/dly_d040817_test.dat of...
6
by: Steve | last post by:
I'm playing with late binding and trying a very simple test to load an assembly In my "Host" application I have this code: <code> string modulePath =...
3
by: db2udbgirl | last post by:
Env: DB2 UDB 8.2, AIX 5.3 While trying to load data (73 Million rows, Medium size table uses 4K tablespace) into a table using cursor it fails with "SQL0964C The transaction log for the database...
1
by: dbagirltx | last post by:
We have done some testing with mixed and forgotten results. So I'm hoping that asking here can clarify some issues for us. Right now we do one weekly warm backup. Throughout the week there are...
1
by: huyuhui | last post by:
The following is a question of LOAD utility. Question: How does the DB2 enforce table check constraints for data added to table with the LOAD utility? A. With the BUILD phase of LOAD B. With the...
2
by: contractsup | last post by:
Environment: $ uname -a AIX <withheld2 5 000100614C00 $ db2level DB21085I Instance "<withheld>" uses "32" bits and DB2 code release "SQL08024" with level identifier "03050106"....
2
by: David Thielen | last post by:
So we have moved our app from .NET version 2.X in IIS6 to a Windows 2008 Server running IIS7. We have copied all files to the Windwardreports\apps directory and that apps directory has been...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.