"Lemune" <al**************@gmail.comschrieb
Thanks Cor, for your answer.
But it still not working.
I create a simple form that only had pbAnimation.
Then in my application(the question), first i create the instance of
the form, then show it.
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click
Dim frmPending As New Pending
frmPending.Show()
'
'
'
On each time i want to stop the animation, I hide the form. But It's
doesn't work like i wanted.
It still didn't show the animated gif, the time to load is about 3
s.
As I guessed, the animation does not show because there is no time to
animate the gif because the thread is busy opening the connection. So you
have (at least) two options: Create a Form containing the Gif, as Cor said,
but in another thread. The thread won't be blocked and can animate the Gif.
Or, keep the gif on the same Form and open the connection in another thread.
This will take some more efforts because the application will have to handle
a "opening connection" state and your sub will have to be split into two
parts: one before and one after opening the connection. If it's worth just
for an animated Gif, I would probably put the whole saving task into a
seperate thread, not only opening the connection (unless you need it
multiple times; as always it depends...). Otherwise just show the
"WaitCursor" Cursor.
Armin