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?

Re: Cancel Button 80 80

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

Re: Cancel Button 80 80

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
Re: Cancel Button 80 80

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 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.