title: Yes/No function in a messagebox
body: <p>I want to add a yes/no function to a message box (Are you sure you want to exit?)  in InfoPath 2007.  If the user clicks 'Yes' the InfoPath form closes, if no, then the user is taken back to the form.  From what I have read this will not happen in InfoPath.  So, I added a new windows form that has the Yes/No buttons. </p>
  
  <p>For the 'No' button, I have (me.close) which closes the windows form and the user is left with the InfoPath form.  I need help when the user clicks 'Yes' meaning they want to close the windows form AND the InfoPath form.  Below is my code so far.  Many thanks in advance.</p>
  
  <pre><code>Imports Microsoft.Office.InfoPath 
  Imports System 
  Imports System.Xml 
  Imports System.Xml.XPath 
  Imports System.Diagnostics
  
  Public Class Confirm_Close 
  Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click 
  
  Me.Close() 
  
  End Sub 
  
  Private Sub btnYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYes.Click 
  
  Try 
  
  &lt;need help here&gt;
  
  Catch ex As Exception 
  
  Console.WriteLine(ex.Message) 
  
  End Try 
  
  End Sub 
  
  End Class
  </code></pre>