473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Play animated gif on waiting

Hi..
I am developing an application that connect to database on the other
side of the net.
And each time i want to connect to database and run some sql command,
i want my user to know that there is some process is runing. My idea
is to show animated gif until the process is done.
My question is how i could achieved that? Any one could give me a clue
or hint or even sample code?
Thank you?
This is my snippet code:

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click
Dim strQuery As String
Dim Connection As New clsConnection 'I am using my class
Dim Settings As New clsSettings 'I am using my class
Dim blnConnect As Boolean = False
Private Const strAppName As String
If NotNull(txtName) Or NotNull(txtUnit) Or NotNull(txtPacking)
Or NotNull(txtPoint) Or NotNull(txtPricePoint) Or NotNull(txtPrice)
Then
MsgBox("Data with * mark must not empty.",
MsgBoxStyle.Information, "Information")
Exit Sub
End If
'Here i want o star play animated gif
If
Connection.OpenConnection(Settings.getStrConnectio n(strAppName)) =
True Then
Clear()
blnConnect = True
Else
'stop animated gif
MsgBox("Could not connect to database.",
MsgBoxStyle.Critical, "Warning.")
blnConnect = False
Exit Sub
End If
strQuery = "Insert Into products
(name,unit,packaging,point,price_point,price) VALUES ('" &
txtName.Text & "','" & _
txtUnit.Text & "','" & txtPacking.Text & "','" &
txtPoint.Text & "','" & txtPricePoint.Text & "','" & _
txtPrice.Text & "')"

Select Case conProduct.Transaction(strQuery)
Case Is < 0
MsgBox("There is an error when saving data.",
MsgBoxStyle.Information, "Information")
Connection.TerminateDatabase()
'stop animated gif
Exit Sub
Case Is = 0
MsgBox("There is no data saved.",
MsgBoxStyle.Information, "Information")
Connection.TerminateDatabase()
'stop animated gif
Exit Sub
Case Else
MsgBox("Data has been saved.",
MsgBoxStyle.Information, "Information")
End Select
Connection.TerminateDatabase()
'stop animated gif
Clear()
End Sub

Jun 23 '07 #1
7 14494
Alfred

Drag a picturebox on your form
Set it to dock fill
Set Sizemode to StretchImaga
Choose in your property box your gif annimation

That is all

Cor
"Lemune" <al**************@gmail.comschreef in bericht
news:11*********************@z28g2000prd.googlegro ups.com...
Hi..
I am developing an application that connect to database on the other
side of the net.
And each time i want to connect to database and run some sql command,
i want my user to know that there is some process is runing. My idea
is to show animated gif until the process is done.
My question is how i could achieved that? Any one could give me a clue
or hint or even sample code?
Thank you?
This is my snippet code:

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click
Dim strQuery As String
Dim Connection As New clsConnection 'I am using my class
Dim Settings As New clsSettings 'I am using my class
Dim blnConnect As Boolean = False
Private Const strAppName As String
If NotNull(txtName) Or NotNull(txtUnit) Or NotNull(txtPacking)
Or NotNull(txtPoint) Or NotNull(txtPricePoint) Or NotNull(txtPrice)
Then
MsgBox("Data with * mark must not empty.",
MsgBoxStyle.Information, "Information")
Exit Sub
End If
'Here i want o star play animated gif
If
Connection.OpenConnection(Settings.getStrConnectio n(strAppName)) =
True Then
Clear()
blnConnect = True
Else
'stop animated gif
MsgBox("Could not connect to database.",
MsgBoxStyle.Critical, "Warning.")
blnConnect = False
Exit Sub
End If
strQuery = "Insert Into products
(name,unit,packaging,point,price_point,price) VALUES ('" &
txtName.Text & "','" & _
txtUnit.Text & "','" & txtPacking.Text & "','" &
txtPoint.Text & "','" & txtPricePoint.Text & "','" & _
txtPrice.Text & "')"

Select Case conProduct.Transaction(strQuery)
Case Is < 0
MsgBox("There is an error when saving data.",
MsgBoxStyle.Information, "Information")
Connection.TerminateDatabase()
'stop animated gif
Exit Sub
Case Is = 0
MsgBox("There is no data saved.",
MsgBoxStyle.Information, "Information")
Connection.TerminateDatabase()
'stop animated gif
Exit Sub
Case Else
MsgBox("Data has been saved.",
MsgBoxStyle.Information, "Information")
End Select
Connection.TerminateDatabase()
'stop animated gif
Clear()
End Sub

Jun 23 '07 #2
"Cor Ligthert [MVP]" <no************@planet.nlschrieb
Alfred

Drag a picturebox on your form
Set it to dock fill
Set Sizemode to StretchImaga
Choose in your property box your gif annimation

That is all

Will it be animated in another thread? (I didn't try) Because the same
thread will be blocked.
Armin

Jun 23 '07 #3
I have tried your suggestion Cor.
And I'm using Property Visible
But for my application it doesn't work.
So i tried make a simple one that use command button and it's work
well.
This is my simple application:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
if pbAnimation.Visible=True Then
pbAnimation.Visible=False
else
pbAnimation.Visible=True
end if
End Sub

But for real application (my question), it not work, it didn't showing
the animation.

Jun 25 '07 #4
Lemune,

At least you have to put it on a seperate form.
I thougth that was working because the gif has its own annimation however I
am not sure of that.

Cor

"Lemune" <al**************@gmail.comschreef in bericht
news:11**********************@d30g2000prg.googlegr oups.com...
>I have tried your suggestion Cor.
And I'm using Property Visible
But for my application it doesn't work.
So i tried make a simple one that use command button and it's work
well.
This is my simple application:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
if pbAnimation.Visible=True Then
pbAnimation.Visible=False
else
pbAnimation.Visible=True
end if
End Sub

But for real application (my question), it not work, it didn't showing
the animation.

Jun 25 '07 #5
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.

Jun 26 '07 #6
"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

Jun 26 '07 #7
Thanks Cor and Armin.
I will use wait cursor instead.
My purpose is to make user know that something is in process, and with
wait cursor i think is enough, because microsoft also used it.
So my user will be knew about it
Once again thanks for both of you.

Lemune,
Always learn.

Jun 26 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Sparks | last post by:
Anyway... At Europython Guido discussed with everyone the outstanding issue with decorators and there was a clear majority in favour of having them, which was good. From where I was sitting it...
0
by: Charley | last post by:
I have been waiting for a way to create animated gifs from within .Net (VB). Does anyone know of a way to do this yet? THanks, Charles
9
by: John J. Hughes II | last post by:
Is it possible using Image or Bitmap to build and save an animated GIF file? I am not have a problem saving the GIF file just getting the frames added to it. I did find ImageAnimator but it only...
2
by: johnmmcparland | last post by:
I recently came across some code to help play .wav; http://www.codeguru.com/Csharp/Csharp/cs_graphics/sound/article.php/c6143/ and while I got this to work in a stand-alone application, I have...
7
by: Gary Kaucher | last post by:
At the top of the page on my website http://www.itemlook.com I have an animated gif called "eyeline.gif". It has worked fine in the past, but recently I am unable to get it to work using IE6. All...
2
by: Ben Fidge | last post by:
Can anyone recommend any good controls to implement animated buttons. I want something that can perform the following: - Must initially display a static image - When clicked the button must...
1
by: Terry Olsen | last post by:
I'm working on a file copy component. I'd like to load the "file copy" animation from the shell32.dll and play it (in a picturebox?) while the file is copying. This guy did it here,...
27
by: Phil | last post by:
I thought it would be nice to display some animated GIFs on some of my forms. I put a PictureBox control on a form, and loaded my GIF file in. It animates, but not properly. It seems very jerky and...
5
by: | last post by:
Hello, I am wrtting a program that does some sound effects... the files are stored in a subfolder in the application folder... and I check the existence of the files before calling the method to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.