Close form and ask for save


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Any built in method that I can call to close a form which will ask for save if datatable is dirty?

Thank you

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
The StrataFrame baseform already does this when a BO which is dropped on this form is dirty.  By default this functionality already exists.  You have to set the forms AutoAskSaveChanges property to False to prevent this type of functionality.
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have set the "AutoAskSaveChanges" property to true. It works when I close the form interactively. How could to have the same "behavor" if I want to close the form programmatically? Currently, I tried to form.Dispose(), the form just released without and prompt.

Please advice

Thank you

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This is handled in the FOrmClosing event of the form, so anything that logically attempts to close the form should trigger the message.  For example:

Me.Close()

Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi.

How could I know the form is really closed? User may select "cancel" in ask for save dialog.

Thank you

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Handle the FormClosed event.  This want you know for sure that the form has been closed.
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

What I am doing is to interate all forms, close them and launch connection dialog. Therefore, i couldn't handle formclosing event.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You could if you iterate through all of the forms and add a handler that references a single method:

Dim loForm As Form

For Each loForm In MyFormsCollection
    AddHandler loForm.FormClosing, Addressof YourFormClosingMethod
Next

You could then place your code in the "YourFormClosingMethod" to check on whatever you needed.

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Trent L. Taylor (04/17/2007)
The StrataFrame baseform already does this when a BO which is dropped on this form is dirty. By default this functionality already exists. You have to set the forms AutoAskSaveChanges property to False to prevent this type of functionality.




I have a "menu" form (it have a Business object to populate a treeview)

When I close the applicaction, it show the save dialog can I avoid this to happen on that form? thanks!
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Note about the last post: I only fill a Business object (but not edit any property of them... only filter it sometimes) and fill a treeview with that data



I set on the form:

Me.myBO1.IncludeInFormSave = False

Me.IncludeInFormSaveType = MicroFour.StrataFrame.Business.IncludeInFormTypeOptions.DeterminedByBusinessObject



if I set

Me.AutoShowSaveChangesMessage = False or me.myBo1.clear() and close the form, this not say if I like to save



me.MenuesBO1.IsDirty = true when I test it after the fill method



What I made wrong? thanks!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search