I'd use this because it will take care of any way that the form is being closed, even if it's the user clicking the x in the upper right corner.
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MessageBox.Show("Do you want to exit?", "Exit?", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
e.Cancel = True
End If
End Sub