L
Lemune
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.getStrConnection(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
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.getStrConnection(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