title: Windows Form Cancel Button Not Working
body: <p>I have a Visual Studio, Visual Basic form that includes an OK button and a Cancel button.</p>
  
  <p>What I want to do is have the OK button save the options that the user chooses and of course the Cancel button discarding them and returning them to their previous values.</p>
  
  <p>But what I'm noticing is that as I'm debugging the form, the values are being saved regardless of whichever button I'm choosing. On the form's properties, I have declared that indeed the CancelBtn is the CancelBtn and that the OK button is the OK button, but the values are still being saved regardless.</p>
  
  <p>Is there a better way to do what I would like this form to do?</p>
  
  <p>EDIT: </p>
  
  <p>Here's the code so far for the two buttons, both are being set to close the window. AcceptOption should save the values and CancelOption should just close the form. I'm sorry if this isn't done well but the FAQ's that I found only mention changing the properties of each button and nothing about the code.:</p>
  
  <pre><code>Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles AcceptOptionBtn.Click
      ' Save the Options
      Me.Close()
      ' Close the form
  End Sub
  
  Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles CancelOptionBtn.Click
      ' Close the form
      Me.Close()
  End Sub
  </code></pre>