The way I track this is I have a boolean variable on my form. I set it to false in the load event. If I have a button or other control on my form that the user can use to close the form, I make sure that it sets the variable to true before it calls the Form.Close. Then I use the FormClosing event to catch things like checking if the user saved before exiting:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If boolCloseByButton Then
Else
End If
End Sub
Hope this helps