Go Back   Forums @ The Digital Fix > Gadgets and Gizmos > Computing Forum

Reply
 
Thread Tools Display Modes
Old 13-07-2004, 14:46   #1
Guest 32046
Trusted User
 
Join Date: May 2003
Posts: 5,753
Thanks: 0
Thanked 0 Times in 0 Posts
VB.NET Form Loaded or Similar

Can't seem to find this event.

I'd like to connect to a database once the form has loaded because if I try connecting in form_load() and there's an error, it just hangs. Does anyone know if such an event exists?

Cheers...
Guest 32046 is offline   Reply With Quote
Old 13-07-2004, 15:04   #2
Guest 23135
Trusted User
 
Join Date: Oct 2002
Location: Bristol
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
There are other events you could use, activated paint etc but they will occur more than once.

My question to you would be why are you getting an error and why is it hanging ?

Last edited by killerwattsj; 13-07-2004 at 15:08.
Guest 23135 is offline   Reply With Quote
Old 13-07-2004, 15:22   #3
Guest 32046
Trusted User
 
Join Date: May 2003
Posts: 5,753
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by killerwattsj
There are other events you could use, activated paint etc but they will occur more than once.

My question to you would be why are you getting an error and why is it hanging ?
Tried both activated and paint. Neither do the trick.

If I try and connect within form_load() and there's an error (server is down, incorrect login details) it will hang whilst trying to get a response. The user won't be able to see that the program has even loaded. Not very user friendly.

If I could figure out a way of opening the connection once the form has loaded, I could display a message while it's connecting.
Guest 32046 is offline   Reply With Quote
Old 13-07-2004, 15:39   #4
Guest 23135
Trusted User
 
Join Date: Oct 2002
Location: Bristol
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
I'll admit I'm not a .Net expert but shooting from the hip I would say ....

1) any chance of lowering your timeouts ? So the user will get a quicker response and catching/displaying the errors ?

2) use a second form as a splash screen to let the user know something is loading and then close it once the connection is made (or not)

3) err ... scraping the barrel but start a timer in onload and connect to the db in the timer event ?

Hope that gives you some ideas
Guest 23135 is offline   Reply With Quote
Old 13-07-2004, 17:17   #5
Guest 32046
Trusted User
 
Join Date: May 2003
Posts: 5,753
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by killerwattsj
I'll admit I'm not a .Net expert but shooting from the hip I would say ....

1) any chance of lowering your timeouts ? So the user will get a quicker response and catching/displaying the errors ?

2) use a second form as a splash screen to let the user know something is loading and then close it once the connection is made (or not)

3) err ... scraping the barrel but start a timer in onload and connect to the db in the timer event ?

Hope that gives you some ideas
Cheers mate.

The connectiontimeout property is read only so I think I'll have to look at the option in the server config.

The second form seems a good idea though, I'll give that a try.
Guest 32046 is offline   Reply With Quote
Old 13-07-2004, 17:47   #6
Guest 2612
Banned
 
Join Date: Jan 2001
Posts: 1,251
Thanks: 0
Thanked 0 Times in 0 Posts
whsy it hanging? The connection should havea timeout property you can set or it defaults to 30 seconds i think. So long as you put it in a Try...Catch then it should drop out and report the error to the user.

try
conection gubbins here
catch ex as exception
msgbox ex.description
end try

that sort of thing?
Guest 2612 is offline   Reply With Quote
Old 13-07-2004, 18:45   #7
Guest 32046
Trusted User
 
Join Date: May 2003
Posts: 5,753
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Spam
whsy it hanging? The connection should havea timeout property you can set or it defaults to 30 seconds i think. So long as you put it in a Try...Catch then it should drop out and report the error to the user.

try
conection gubbins here
catch ex as exception
msgbox ex.description
end try

that sort of thing?
What happens is, the user launches the application, on launching it the application attempts to connect to the server. If there's a problem, it will take around 30 seconds (or however long the timeout is) to respond. So it's basically hanging. The user will wonder what the hells going on and probably end the task.

But this second form idea will probably do the trick.
Guest 32046 is offline   Reply With Quote
Reply

Bookmarks

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 On
HTML code is On

Forum Jump

All times are GMT. The time now is 04:49.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.qq
Copyright ©2000 - 2021 Network N Ltd.