473,785 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1411
On Jul 17, 1:43*pm, "John Wright" <riley_wri...@h otmail.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**********@h otmail.comwrote in message
news:eY******** ******@TK2MSFTN GP04.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...@h otmail.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...@h otmail.comwrote in message

news:eY******** ******@TK2MSFTN GP04.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(10 00) 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.Threa d.Sleep(4000)

CheckNetwork()

Threading.Threa d.Sleep(4000)

CheckDB()

Threading.Threa d.Sleep(4000)

CheckEPN()

Threading.Threa d.Sleep(4000)

My.Forms.frmMai n.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_newsgroup s" <ro********@yah oo.comwrote in message
news:9d******** *************** ***********@c58 g2000hsc.google groups.com...
On Jul 17, 3:34 pm, "John Wright" <riley_wri...@h otmail.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...@h otmail.comwrote in message

news:eY******** ******@TK2MSFTN GP04.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(10 00) 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.Refres h. 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 UpdateStatusDel egate(ByVal Status As String, ByVal
progress As Integer)

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

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

If Me.InvokeRequir ed Then

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

Else

Me.lblStatus.Te xt = 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.Updat eStatus("Starti ng EPN...", 20)

Threading.Threa d.Sleep(3000)

EPNSplash.Updat eStatus("Checki ng Network...", 40)

Threading.Threa d.Sleep(3000)

EPNSplash.Updat eStatus("Checki ng Database...", 60)

Threading.Threa d.Sleep(3000)

EPNSplash.Updat eStatus("Connec ting to EPN system...", 80)

Threading.Threa d.Sleep(3000)

EPNSplash.Updat eStatus("Progra m loaded.Initiali zing...", 100)

Threading.Threa d.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
14169
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 Smarty-2.6.7.tar.gz on a system running WindowsXP SP2. Apache and PHP tested out fine. After adding Smarty, I ran the following http://localhost/testphp.php
4
3009
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 in the CD tables. I look at the subscription sets and see that everything seems to be pointing to the right tables, etc., and see that apply is running. The apply log states that the program is running, but nothing is moving. The only diagnostics...
8
1429
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 OS startup, is there a way to do that? Thank you very much! Regards,
5
2638
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 could use? I'm using Microsoft Visual Basic 2005 Express Edition. Thanks in advance.
27
2082
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 exe is still in use--I find it is still a process in Task Manager. What do I need to do to make clicking that X actually end the program? Public Class Form1 Inherits System.Windows.Forms.Form
55
16715
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, I wrote ";" (Semicolon), so, program output will display blank screen. But Friends, I am not sure, Does anyone has perfect solution?
4
2107
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 Microsoft.DirectX.AudioVideoPlayback.Audio class for that purpose. My problem is whenever I send a command to the program windows gives an error related to the directX, and shuts down the program. However if I run the program manually after the startup it works just fine. I have...
8
1024
by: iwdu15 | last post by:
hi, how can i get my program to start on every boot of the computer? -- -iwdu15
1
3587
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 the bat file and startup my Java Program. For this purpose, I have tried to place the bat file into share drive of two computers which are cluster machine. Also, I used Generic Application to create a job to call my bat file and this job is...
2
1585
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 "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, ByVal phkResult As Long) As Long Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String) As Long...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.