How handle user selecting close box. 
Author Message
 How handle user selecting close box.

I have a close icon on a winform that runs some "checking" code, prior to
closing the window,  if the user clicks it.  However, the Winform also has a
close box (x) in the upper right hand corner.  I don't know how to run the
same code if the user trys to get out of the winform by clicking the x box.
Could someone advise?


Wed, 05 Oct 2005 06:19:21 GMT  
 How handle user selecting close box.
Hello Woody,


Quote:
> closing the window,  if the user clicks it.  However,
> the Winform also has a close box (x) in the upper right
> hand corner.  I don't know how to run the same code if
> the user trys to get out of the winform by clicking the x box.

Add a handler for the Closing event:

\\\
Private Sub Form1_Closing( _
    ByVal sender As Object, _
    ByVal e As CancelEventArgs _
) Handles MyBase.Closing
    .
    .
    .
End Sub
///

Regards,
Herfried K. Wagner



Wed, 05 Oct 2005 06:40:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to close CMDialog after user selects cancel

2. Prevent user from closing form using caption close button

3. Tip : VB.NET Form Won't Close on Me.Close + User Controls

4. How to prevent user closing a mdi form using the close control button

5. Close from Control Box Doesn't Close Application

6. Cetting A Report To Select Records Based Upon A Value Selected In A Combo Box

7. Setting the selected option of a select box in code

8. Select all text when selecting a text box?

9. handle of list box portion of a combo box

10. selecting records for 2nd combo box dependant on first combo box

11. Problems making a automatic text box when selecting in a combo box

12. Select Directory dialog box like Comm Dialog Box

 

 
Powered by phpBB® Forum Software