Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch the close control
Message
From
11/02/2008 10:20:55
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01291393
Message ID:
01291422
Views:
7
This message has been marked as the solution to the initial question of the thread.
>Hi everybody:
>
>Here we go again! I'm trying to avoid the user to exit the form using the X in the corner of the form. Please dont suggest to remove the control because is not allow in the design. I use the "Handles Me.FormClosing" but I need to stop closing if the user have changes that did not save. Any Ideas will be apreciated.
>
>TK
>
>PD
>
>Happy New Year 2008!!! Late but sure.


in c# you do it like this:
     private void MainForm_Closing(object sender, CancelEventArgs e)
     {
         bool shouldICloseMyForm = !DataSet.HasChanges();
         e.cancel = shouldIcloseMyForm;       
     }
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform