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 7 14313
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
"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
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.
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.
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.
"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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
|
by: F22F35 |
last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...
| |