HalbeSuppe
HalbeSuppe

Reputation: 47

Winform applicaton not animating picturebox gif while processing data from Excel

I am currently developing a C# WinForms program which reads data from an excel file and processes it. This process has a duration up to 5 seconds so I want to show a little rotating gif, so that the user knows that the program actually is processing data and not broken.

So I googled a fitting gif and used a picturebox in visual studio 2017. I am using a picturebox and set the Image to the local gif. After that, the property Image shows "System.Drawing.Bitmap".

If I run the program whilst the picturebox is visible, or trigger the visibility whilst not processing data, the gif is animated. During the dataprocessing, the animation is not shown - I do not use any kind of multithreading in this program as it is pretty small.

Any help would be appreciated. Br

Upvotes: 0

Views: 870

Answers (1)

Driton Gjuraj
Driton Gjuraj

Reputation: 76

In case you have a loop inside of youre code add

Application.DoEvents()

inside of the loop

Upvotes: 1

Related Questions