"DoEvents" or update GUI while a database query is running

surrealmadrid

New member
Joined
Aug 11, 2011
Messages
1
Programming Experience
10+
Hello

I have an application that performs database queries using "Imports System.Data.SqlClient"

I want to display an animated GIF on the taskbar which spins while the query is running. However, during a query the application simply hangs and does not update the GUI until the query has finished, at which point the spinning icon is set to invisible anyway.

Is there any way to force the GUI to update while the query runs?

Thanks
 
Create as seperate thread and run the query asynchronously with a callback informing you when the process is complete.
Moderate Difficulty. Plenty of samples online.
 
The BackgroundWorker simplifies what FluidOne is suggesting. Simply set up the GUI first, call RunWorkerAsync, do your work in the DoWork event handler and then update the GUI in the RunWorkerCompleted event handler.
 
Back
Top