473,322 Members | 1,755 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,322 software developers and data experts.

Program Startup

During my program startup I need to check for a couple of things.
1. I need to check for network availability
2. I need to check for database connectivity
3. I need to check for access to the server via a webservice

I have written the code to do all of these things. Now I want to put them
into a startup form. I want to load my main form, but from the main form I
want to call a splash screen with an animation on it that will cycle through
all the above events. This will let the user know there is action going on.
Also, if the network or database connection fails, I want to prevent them
from using the program or store the files locally. If the server cannot be
accessed, I will write the data to the database then process later. Again
the code for these actions are done. What I need is a really good way of
showing a splash screen, update a label on the splash screen while checking
for these items, then close the splash screen.

I can load the splash screen as follows

Dim mySplash as new splashScreen
mySplash.Show

This will show the screen, but I need suggestions to update the label on the
screen while checking for the items above. Anyone have a good idea or can
point me to an article on a good way to use a splash screen?

Thanks.

John
Jul 17 '08 #1
6 1395
On Jul 17, 1:43*pm, "John Wright" <riley_wri...@hotmail.comwrote:
During my program startup I need to check for a couple of things.
* * 1. *I need to check for network availability
* * 2. *I need to check for database connectivity
* * 3. *I need to check for access to the server via a webservice

I have written the code to do all of these things. *Now I want to put them
into a startup form. *I want to load my main form, but from the main form I
want to call a splash screen with an animation on it that will cycle through
all the above events. *This will let the user know there is action going on.
Also, if the network or database connection fails, I want to prevent them
from using the program or store the files locally. *If the server cannot be
accessed, I will write the data to the database then process later. *Again
the code for these actions are done. *What I need is a really good way of
showing a splash screen, update a label on the splash screen while checking
for these items, then close the splash screen.

I can load the splash screen as follows

Dim mySplash as new splashScreen
mySplash.Show

This will show the screen, but I need suggestions to update the label on the
screen while checking for the items above. *Anyone have a good idea or can
point me to an article on a good way to use a splash screen?

Thanks.

John
If it were me, I'd start the application from a module using Sub
Main(), show the splash screen, and pop events from the module that
the splash screen would subscribe to. These events would contain the
text to display on the splash screen and any other applicable data.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 17 '08 #2
Okay,

I set up a sub main to run and raised events. I subscribed to these events
in the form using event handlers. I simulated the connections and ran. I
got the outline of the form which appears while the process runs then it
goes away.

So I tried a background worker thread with the same results. Do I need to
refresh the form? How can I show the form all the way on a load like this?

John
"John Wright" <ri**********@hotmail.comwrote in message
news:eY**************@TK2MSFTNGP04.phx.gbl...
During my program startup I need to check for a couple of things.
1. I need to check for network availability
2. I need to check for database connectivity
3. I need to check for access to the server via a webservice

I have written the code to do all of these things. Now I want to put them
into a startup form. I want to load my main form, but from the main form
I want to call a splash screen with an animation on it that will cycle
through all the above events. This will let the user know there is action
going on. Also, if the network or database connection fails, I want to
prevent them from using the program or store the files locally. If the
server cannot be accessed, I will write the data to the database then
process later. Again the code for these actions are done. What I need is
a really good way of showing a splash screen, update a label on the splash
screen while checking for these items, then close the splash screen.

I can load the splash screen as follows

Dim mySplash as new splashScreen
mySplash.Show

This will show the screen, but I need suggestions to update the label on
the screen while checking for the items above. Anyone have a good idea or
can point me to an article on a good way to use a splash screen?

Thanks.

John

Jul 17 '08 #3
On Jul 17, 3:34*pm, "John Wright" <riley_wri...@hotmail.comwrote:
Okay,

I set up a sub main to run and raised events. *I subscribed to these events
in the form using event handlers. *I simulated the connections and ran.*I
got the outline of the form which appears while the process runs then it
goes away.

So I tried a background worker thread with the same results. *Do I needto
refresh the form? *How can I show the form all the way on a load like this?

John"John Wright" <riley_wri...@hotmail.comwrote in message

news:eY**************@TK2MSFTNGP04.phx.gbl...
During my program startup I need to check for a couple of things.
* *1. *I need to check for network availability
* *2. *I need to check for database connectivity
* *3. *I need to check for access to the server via a webservice
I have written the code to do all of these things. *Now I want to putthem
into a startup form. *I want to load my main form, but from the main form
I want to call a splash screen with an animation on it that will cycle
through all the above events. *This will let the user know there is action
going on. Also, if the network or database connection fails, I want to
prevent them from using the program or store the files locally. *If the
server cannot be accessed, I will write the data to the database then
process later. *Again the code for these actions are done. *What I need is
a really good way of showing a splash screen, update a label on the splash
screen while checking for these items, then close the splash screen.
I can load the splash screen as follows
Dim mySplash as new splashScreen
mySplash.Show
This will show the screen, but I need suggestions to update the label on
the screen while checking for the items above. *Anyone have a good idea or
can point me to an article on a good way to use a splash screen?
Thanks.
John
The problem is most likely that your connectivity checks are occurring
too fast, you'll probably need to add in some logic to keep the splash
screen showing for a while. Before doing anything heavy duty, you
could try opening the form on a seperate thread and then doing a
Thread.Sleep(1000) between the connectivity checks in Sub Main. If
that works you can look at writing the long term solution.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 17 '08 #4
Here is the code that is doing the checks on the form:

Threading.Thread.Sleep(4000)

CheckNetwork()

Threading.Thread.Sleep(4000)

CheckDB()

Threading.Thread.Sleep(4000)

CheckEPN()

Threading.Thread.Sleep(4000)

My.Forms.frmMain.Show()

I am doing a sleep for 4 seconds between calls. Also, when I load the form,
the animation loads just fine, but the first call to the method that updates
the label freezes the animation and the form until it is loaded. I'll just
keep plugging at it I guess.

John

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:9d**********************************@c58g2000 hsc.googlegroups.com...
On Jul 17, 3:34 pm, "John Wright" <riley_wri...@hotmail.comwrote:
Okay,

I set up a sub main to run and raised events. I subscribed to these events
in the form using event handlers. I simulated the connections and ran. I
got the outline of the form which appears while the process runs then it
goes away.

So I tried a background worker thread with the same results. Do I need to
refresh the form? How can I show the form all the way on a load like this?

John"John Wright" <riley_wri...@hotmail.comwrote in message

news:eY**************@TK2MSFTNGP04.phx.gbl...
During my program startup I need to check for a couple of things.
1. I need to check for network availability
2. I need to check for database connectivity
3. I need to check for access to the server via a webservice
I have written the code to do all of these things. Now I want to put
them
into a startup form. I want to load my main form, but from the main form
I want to call a splash screen with an animation on it that will cycle
through all the above events. This will let the user know there is
action
going on. Also, if the network or database connection fails, I want to
prevent them from using the program or store the files locally. If the
server cannot be accessed, I will write the data to the database then
process later. Again the code for these actions are done. What I need is
a really good way of showing a splash screen, update a label on the
splash
screen while checking for these items, then close the splash screen.
I can load the splash screen as follows
Dim mySplash as new splashScreen
mySplash.Show
This will show the screen, but I need suggestions to update the label on
the screen while checking for the items above. Anyone have a good idea
or
can point me to an article on a good way to use a splash screen?
Thanks.
John
The problem is most likely that your connectivity checks are occurring
too fast, you'll probably need to add in some logic to keep the splash
screen showing for a while. Before doing anything heavy duty, you
could try opening the form on a seperate thread and then doing a
Thread.Sleep(1000) between the connectivity checks in Sub Main. If
that works you can look at writing the long term solution.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 17 '08 #5
John Wright wrote:
>
I am doing a sleep for 4 seconds between calls. Also, when I load
the form, the animation loads just fine, but the first call to the
method that updates the label freezes the animation and the form
until it is loaded. I'll just keep plugging at it I guess.
If you put the UI thread to sleep for 4 seconds, and otherwise keep it busy with
your checks, then yes, the form will never have a chance to paint.

If you just want to update a label, do a mySplash.Refresh. If there is some sort
of animation that is supposed to run on the splash, then you would need to do
the checks on a background thread.

Jul 18 '08 #6
Got it to work. Here is what I did.

On my splash screen I created the following:
Public Delegate Sub UpdateStatusDelegate(ByVal Status As String, ByVal
progress As Integer)

Then I created the following Sub on the splash screen to call:

Public Sub UpdateStatus(ByVal status As String, ByVal progress As Integer)

If Me.InvokeRequired Then

Me.Invoke(New UpdateStatusDelegate(AddressOf Me.UpdateStatus), New Object()
{status, progress})

Else

Me.lblStatus.Text = status

Me.ProgressBar1.Value = progress

End If

Me.Refresh()

End Sub

Then from the main form I call as follows (to simulate the load for now, I
will call the updatestatus as I load):

EPNSplash.Show()

EPNSplash.UpdateStatus("Starting EPN...", 20)

Threading.Thread.Sleep(3000)

EPNSplash.UpdateStatus("Checking Network...", 40)

Threading.Thread.Sleep(3000)

EPNSplash.UpdateStatus("Checking Database...", 60)

Threading.Thread.Sleep(3000)

EPNSplash.UpdateStatus("Connecting to EPN system...", 80)

Threading.Thread.Sleep(3000)

EPNSplash.UpdateStatus("Program loaded.Initializing...", 100)

Threading.Thread.Sleep(3000)

EPNSplash.Close()

Works like a charm. Thanks one and all for the help.

John
Jul 22 '08 #7

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
4
by: esmith2112 | last post by:
Having a bear of a time trying to implement replication under 8.2 environment. I've created all of the control structures on both source and target database and can actually see data being staged...
8
by: ZhangZQ | last post by:
How to make the Windows to run a console program during OS startup, like the Chkdsk program to do when the OS does not shutdown properly? Now I want to run my program instead of Chkdsk during the...
5
by: Casper | last post by:
I'm trying to get my program to run in the system tray. I've looked at dozend of tutorials on the web and on newsgroups but I just dont get it! Has anyone got any links or example code that ...
27
by: cj | last post by:
I run this program and to exit click the X in the upper right corner. But apparently it isn't really ending the program. If I return to VB and make changes then try to rebuild the app it says the...
55
by: Dev | last post by:
Hello Folks, I had faced this objective in one of my aptitude exams, that "What could be the smallest "C" program? And, as we know, smallest program means, it should execute single statement,...
4
by: duzinga | last post by:
I am trying to have a server program that runs at startup and accepts several commands from the clients. One of the commands is to play an audio file. I am using...
8
by: iwdu15 | last post by:
hi, how can i get my program to start on every boot of the computer? -- -iwdu15
1
by: =?Utf-8?B?S2Vubnk=?= | last post by:
I have one bat file that contains a command to startup Java Program. Then, I would like to create a cluster job to call the bat file. In case of one computer is down, another computer can also call...
2
shek124
by: shek124 | last post by:
I want to run a windows startup program. here my code: Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long Public Declare Function RegCreateKey Lib...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.