Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window content is not available in heavy duty

Status
Not open for further replies.

Stoemp

Programmer
Sep 25, 2002
389
0
0
BE
Hi,

I have a routine where the program reads a TXT file with 10.000 lines and puts it in a database (lines are read with regular expressions). When doing this operation, the content of the main window is mainly invisible. It seems the program has crashed while it isn't the case. The program is just doing a heavy job. Can't I put something in the code that the GUI gets priority, so that the GUI looks normal. Otherwise the users will shut down the process when they see that the program appears to be not responding.

Thanks,

Steven
 
Why not use threading? Spawn a thread to take care of the work and display something on the form to indicate that it is busy until the thread is through.

 
I don't have a clue how I can do that. I just got the basics in programming...
 
I recommend that you experiment with threading. You can create threads easily:

public sub work
' Add code to do the heavy work
end sub

public sub startwork
dim t as new system.threading.thread(addressof me.work)
t.start
end sub

In the "startwork" procedure a new thread is created to take care of the "work" procedure, then the startwork procedure continues executing simultaneously returning functionality to the UI while the "work" procedure is executing.

Once you get the idea of this simple approach look into asynchronous calls which allow greater control over execution of multiple threads.
 
Thanks for the advice. I'll look into it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top