Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Using animated GIFs as "Please Wait" images

Posted on 2007-12-05
Medium Priority
Last Modified: 2010-04-21
I have an animated GIF that I would like to use in my VB .NET application when a process is running. It works fine with asynchronous tasks but the problem I have is with processor intensive tasks, the animation stops until the line of code has been executed.

I have a third party control on one of my forms and it takes two or three seconds to initialise, because I dont have access to the inner workings of the control I cannot use Application.DoEvents.

I have tried putting my GIF on a different form and loading it before the code line runs thinking that it may be on a different thread but it does the same thing.

I dont necessarily think this is a problem with the GIF as I have tried a progress bar in marquee mode, it too stops when it reaches the line of code.

Does anybody know how I can get around this?
Question by:3Si_pnewman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
LVL 53

Expert Comment

ID: 20410842
It looks like you need to use threading.
Thread Programming

Threading in .NET Part 2
LVL 48

Accepted Solution

jpaulino earned 450 total points
ID: 20410850
You have to use a multi-threads.

Look this example http://support.microsoft.com/kb/315577

Author Comment

ID: 20411517
I have tried a couple of threading methods but I still cant get it to work, I think the control is locking foreground thread.

I have amended the Microsoft example slightly to try and replicate my problem, it can be found here http://files.filefront.com/ThreadWinAppzip/;9195002;/fileinfo.html

If you click the button the animation and progress bar both stop until the count has finished.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 48

Expert Comment

ID: 20411550
Can upload in another site ? My system polices filter is locking that site.

Can you use ee-stuff.com

Author Comment

ID: 20411591
LVL 48

Expert Comment

ID: 20411944
You have to lunch a new thead for the cycle  not for the animation. An easy way (I use it allot)

Add a BackGroundWorker to your project then:

Private Sub BackGroundWorker1.DoWork(...) Handler backgroundoworker1.DoWork
    ' Add your cycle
   For x As Integer = 1 to 2000
   Next X
End Sub

And in the button1.click event simply do

LVL 21

Expert Comment

ID: 20412036
I don't have an answer offhand but would venture the problem is that the 3rd party control and your animated gifs are both running on the form and both using the message pump thread.  Does the 3rd party control have a visual component or is it just doing some functionality?

Author Comment

ID: 20412136
It is a report preview control from http://www.componentone.co.uk/StudioEnterprise/NETToolset.aspx

There is a method that populates the control with the actual document and it sometimes takes a while.  I have tried creating the controls dynamically and not adding them to the form until all the processing is completed on a separate thread (as suggested by jpaulino) but get all kinds of cross-threading errors.

Looking at the stack trace the errors are coming from the control itself not any of my code, I think I might have to contact support and see if they can suggest anything.
LVL 21

Assisted Solution

mastoo earned 300 total points
ID: 20412845
I hate to give an "unhelpful" answer but that might be a best first step.  I'm not aware of a practical method of keeping a responsive gui when a visual component won't yield the message pump which is what this sounds like.

Author Closing Comment

ID: 31412827
Im getting nowhere fast so I think I'll have to give support a go.

Thanks for your help.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question