|
-
Jun 23rd, 2005, 10:42 AM
#1
Thread Starter
New Member
Problem with application hang up/slow down
I have written several VB.NET apps that 'hang up' when the user accesses another application or even clicks on the desktop taking focus off the VB app. Moving the cursor back over the app simply displays an hour glass. If the user ceases all activity on the PC, the app occassionally continues and completes its task after a significant wait. If the user continues to use other apps on the PC, the app remains stalled.
These apps all access/update server data (DB2 and/or SQL Server) and are NOT very sophisticated in what they are doing. Clients are pentium class 2.4-3.4 GHz using XP pro (512MB RAM or better) on a GB Ethernet newtork.
Any ideas or assistance would be appreciated.
-
Jun 23rd, 2005, 11:10 AM
#2
Hyperactive Member
Re: Problem with application hang up/slow down
Do you have any loops in there that might take a while to exit? Maybe some timers that do something constantly?
-
Jun 23rd, 2005, 12:35 PM
#3
Thread Starter
New Member
Re: Problem with application hang up/slow down
No timers.
One of the apps uses a data reader to pull records from a DB2 database. Each record is manipulated and written to a SQL Server db before looping back for the next record. Unfortunately, the problem I described will occur even before this loop is triggered.
A second app reads data from an Excel spreadsheet, manipulates it, and writes back to a different tab on the spreadsheet. I guess this loop may take awhile to exit, but shouldn't the compiled VB app continue running in the background like any other Windows-based app? Also, the applications complete rather quicky when focus remains on them regardless of what else was running on the PC before the app was started.
Is there some setting I may be missing to allow the apps to 'thread' properly with the OS?
Thanks.
-
Jun 23rd, 2005, 03:58 PM
#4
Hyperactive Member
Re: Problem with application hang up/slow down
The way you describe it, it sounds like your program does too much "stuff". See how much CPU usage the program takes on Task Manager (with and without focus). If the percentage is too high, you need to find the place (most likely a loop) where code is constantly being executed. Since the program hangs up on you sometimes, put a bunch of breakpoints in different locations and see which breakpoint is never reached... That way you'll know where the problem spot is. Have you tried using Application.DoEvents() in your program?
-
Jun 23rd, 2005, 04:50 PM
#5
Hyperactive Member
Re: Problem with application hang up/slow down
I was using the .Net framework TCPListener class and it was munching a lot (all) of my processor time. I ended up writing my own loop that did what the listener was doing and using the Application.DoEvents() in the loop so that the form would repaint and move correctly. Also I put the loop in a thread and tried a Thread.sleep(1) for 1 milisecond (the minimum time it will sleep) in the same loop. It didn't noticably hurt my app but really helped all the other apps running at the same time.
Thanks,
Eric
--------------------------------------------------------------------------------------------------------------------
VB.net/C# ... Visual Studio 2019
"None of us are as smart as all of us."
-
Jun 29th, 2005, 03:54 PM
#6
Thread Starter
New Member
Re: Problem with application hang up/slow down
Thanks for the input.
I added the Application.DoEvents() and that helped quite a bit. I am also experimenting with some threading options as well.
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|