0

Hi,
I want to have a dialog result to appear when i click on the form's cancel button. It will ask "Do you want to quit?" when the cancel button is clicked. How do i go about doing that?

4
Contributors
3
Replies
8
Views
10 Years
Discussion Span
Last Post by preetham.saroja
0

Get the user's choice from a message box and only set the dialog's DialogResult property to true if they click 'yes'. :)

Private Sub ButtonCancel_Click( ByVal sender As Object, ByVal e As EventArgs ) _
  Handles ButtonCancel.Click

  ' Verify the cancel
  Dim result As DialogResult = MessageBox.Show( "Do you want to quit?", "Confirm Operation", MessageBoxButtons.YesNo )

  If result = DialogResult.Yes Then
    Me.DialogResult = True
  End If
End Sub
0

use this javascript when ur trying web-applications(vb.net,vs-2003 or more..)

btndelete.Attributes.Add("onclick", "if(confirm('Are you sure ,want to delete the record?')){}else{me.server.transfer ('" & "webform1.aspx" & "') } ")

happy coding....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.