I have windows form. I have put one loading image in PictureBox
When I load form then I have set
PictureBox1.Visible = false;
While i am firing click event of button I have set
PictureBox1.Visible = true;
But in that event there is some code to retrieve data from database through stored procedure.
When it will jump to code for retrieving data from stored procedure that loading image stops to load.
It should not be happened. It should show as loading. I have used .gif loading image.
How can I solve this issue ?
Everytime you have a long lasting call within an eventHandler you should use a BackgroundWorker! A BackgroundWorker can run code async and therefor your button_click eventHandler will end right after starting the worker.