jakekula
asked on
Message box in ASP.Net with VB.Net
Hi,
Im using VB.Net with ASP.Net and when I click a button, i would like a message box to come up with 'Yes' and 'No' before the button does it's action. But this produces an error. The code is below:
__________________________ __________ __________ __________ __________ __________ __________ _______
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Create message box
Dim Msg, style, title, response
Msg = "Quit BAS Calculator?"
style = vbYesNo
title = "System Message"
response = MsgBox(Msg, style, title)
If response = vbYes Then
'Clear all rows corresponding to the rep where e has been set to indicate that the row was edited
Dim updateCmd As String
updateCmd = "UPDATE KG_Forecast SET Edit = '' WHERE Rep LIKE '" & Session("UserID") & "'"
Dim myCommand As SqlCommand
myCommand = New SqlCommand(updateCmd, myConnection)
Dim CurrentTextBox As System.Web.UI.WebControls. TextBox
myCommand.Connection.Open( )
Try
myCommand.ExecuteNonQuery( )
dgProducts.EditItemIndex = -1
Catch exp As Exception
lblMessage.Text = "ERROR: " & exp.Message
End Try
myCommand.Connection.Close ()
BindGrid("ID")
End If
End Sub
__________________________ __________ __________ __________ __________ __________ __________ _______
Can anyone help???
Thanks in advance,
JK
Im using VB.Net with ASP.Net and when I click a button, i would like a message box to come up with 'Yes' and 'No' before the button does it's action. But this produces an error. The code is below:
__________________________
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Create message box
Dim Msg, style, title, response
Msg = "Quit BAS Calculator?"
style = vbYesNo
title = "System Message"
response = MsgBox(Msg, style, title)
If response = vbYes Then
'Clear all rows corresponding to the rep where e has been set to indicate that the row was edited
Dim updateCmd As String
updateCmd = "UPDATE KG_Forecast SET Edit = '' WHERE Rep LIKE '" & Session("UserID") & "'"
Dim myCommand As SqlCommand
myCommand = New SqlCommand(updateCmd, myConnection)
Dim CurrentTextBox As System.Web.UI.WebControls.
myCommand.Connection.Open(
Try
myCommand.ExecuteNonQuery(
dgProducts.EditItemIndex = -1
Catch exp As Exception
lblMessage.Text = "ERROR: " & exp.Message
End Try
myCommand.Connection.Close
BindGrid("ID")
End If
End Sub
__________________________
Can anyone help???
Thanks in advance,
JK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks! Was in a bit of a hurry!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just a correction - there is a typo :
it is not confimr but confirm function
Regards!
B..M
mmarinov