Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Eliminating the X in the control box
Message
De
13/01/2010 20:50:38
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01440447
Message ID:
01443872
Vues:
51
Unfortunately, it's probably too late to change your design. <g>

With any Form that I've ever designed, the Form itself controls the saving of the data, regardless of how many "pages" it may contain. IOW, the Form "owns" the DataSet and saves the data. Each "page" could have controls on it that are only bound to one DataTable of the DataSet if that's a requirement, but the Form still controls the entire DataSet and what gets saved.

If it's too late to re-design your Form, then you can use the TabControl.SelectedTab property to determine the active TabPage. (You may want to check the Form's ActiveControl property to be sure that a TabControl is the ActiveControl when the user clicks on the X). Again, all this code would go in the Closing event.

Sorry it took me so long to get back to you, but I was out of town with family all last week.

~~Bonnie




>Thanks, Bonnie. Do you know of a way to identify the last tab page with focus? I could definitely create a property for current tab page. Is there a better option? I have a bunch of tabs, each with checks to make sure there are no unsaved changes and don't want to have to check them all, if I can help it.
>>You could leave it there, but handle the Closing event and cancel it (e.Cancel = true). You'd probably need to have a property on your Form so that if they close it via a button (or however you decide to let them close it), you'd set the property there and then you'd let the Closing event do its thing if that property was set, cancel it otherwise.
>>
>>~~Bonnie
>>
>>
>>
>>>I would like to block users from using the X in the control box to close certain forms but would like to leave them the option of minimizing or maximizing the screens. Is there a way to do that? All I can find is options to eliminate the minimize and maximize buttons or eliminate the control box altogether.
>>>Thanks and Merry Christmas to all.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform