Hello everyone! I have the following problem, I have to connect to database on a remote server. Thats OK, I did it but my program is freezing for a few seconds until its connected. Is there a way to make my program do something else wile doing something like connecting? another problem is that i can not interrupt the connection process because the the code isn't mine, it's a dll I'm connecting through.
I'm using VB.NET 2008
Thanks :)
App not freezing while doing something else
Started by sakishrist, Jan 29 2008 09:43 AM
7 replies to this topic
#1
Posted 29 January 2008 - 09:43 AM
|
|
|
#2
Guest_Jordan_*
Posted 29 January 2008 - 12:48 PM
Guest_Jordan_*
You can try the My.Application.DoEvents() method before and after your connection execution. This may help.
#3
Posted 21 April 2008 - 09:25 AM
I did that but it does not really help because the function that i call takes more than 15 seconds to complete and until then the app is "Not responding" and the bad thing is i can't change the code of that function as it is in a DLL.
Thanks a lot!
Thanks a lot!
#4
Posted 21 April 2008 - 10:30 AM
If you could change the code, I'd suggest sprinkling Application.DoEvents() calls throughout the code. The only thing I can suggest is to run the code using a separate thread. That way, the main thread that handles the responsiveness of the UI is unaffected.
However, directly implementing multiple threads is complicated. You might need to do some work :)
However, directly implementing multiple threads is complicated. You might need to do some work :)
#5
Posted 21 April 2008 - 11:34 PM
I did try the multiple treads and thats exactly what I was looking for. It wasn't so hard to put the connection code to another thread.
Thanks!
Thanks!
#6
Posted 22 April 2008 - 09:48 AM
Er, you're welcome - but actually, I've never actually known how to exactly use multiple threads - could you post the code for me?
It's weird, I just gave you the answer, yet I'm asking for it back from you again...
It's weird, I just gave you the answer, yet I'm asking for it back from you again...
#7
Posted 23 April 2008 - 12:25 PM
I will but not right now ... for now I can just give this link because I'm writing from my PPC. Well it's not so difficult to just make a thread but its getting REALLY thought to control them if there are many of them. For example my application uses 3 threads, they all have to be performed in some logical order and sometimes the main application has to wait for 1 or 2 of them to complete so it can continue without errors, to wait for one thread I have to raise an event so when that event is done the app may continue. Now thats the biggest problem I have ... to synchronize them so there are no errors.


Sign In
Create Account


Back to top









