I've got a project going where I need to do some extensive searching, so I decided it would be best to put that code into a new thread. To make it a little more user friendly I decided to pop up a dialog box with a little animated image informing them that it is searching.

The problem lies in the fact that when I do this, the image will not load. I was using a PictureBox to display the image. So then I decided to try and ghettofy it and just set the dialog's backgroundimage property to the image. Which worked just fine.

But since I would like to use a the animated image, I would like to find out why it's not painting properly.

The code I'm using is:

SearchDialog l_sd = new SearchDialog();
l_sd.Show();

// Search is the method that does all the processing
Thread l_t = new Thread(new ThreadStart(Search));
l_t.Start();
l_t.Join();

l_sd.Close();

So Just for kicks I deicded to NOT use a thread to do the work, but the concept was still the same (1. Show Dialog 2. Process stuff 3. Close Dialog) yet I STILL had the same problem. It will only display the picture when I use the BackGroundImage property, not a PictureBox.

The new code looked like:

SearchDialog l_sd = new SearchDialog();
l_sd.Show();

/*
 * All the searching and crap was here
 */

l_sd.Close();

Just to make matters worse, I found out that it won't even display a label. The ONLY thing it will display is the actual form, and the form background. I just don't know why it won't display labels, pictures, or anything I have heavy processing directly after the show() method.

Any help is appreciated. Thanks :)

Did you found the solution?

I'm Having the same problem, im doing a lengthy operation (mail merge via the code), and wanted to display an animated gif, but it didnt show until i did a this.Refresh() call - but then the gif isnt really moving...

if u managed to solve it - mail me back - please!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.