Link to home
Start Free TrialLog in
Avatar of jakekula
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
ASKER CERTIFIED SOLUTION
Avatar of mmarinov
mmarinov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmarinov
mmarinov

dnoxs,
just a correction - there is a typo :

it is not confimr but confirm function

Regards!
B..M
mmarinov
Thanks! Was in a bit of a hurry!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial