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?

Look into the inputbox function and write the code accordingly. :)

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

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....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.