I am working on a project that has the user building scrapbook pages through several different forms. When the user selects something a presses a button I have the information about the selection load to a list box which is on a CheckoutForm. One of the options I have is for the user to save what they have made (this includes the information in the list boxes) and return to a previous form to build another page. I have been trying to use the Me.Close() but it does not save the information and using Me.Hide() displays the wrong elements on the forms. Any ideas of how to get around this?
Closing a form but keeping the information in the form
Collapse
X
-
-
is this a desktop app you are building or a web based app? because this approach will not work in a web app because web apps are stateless. -
I'm glad you solved your problem...
A Web Application does not use Windows Forms.
There is no "Form.Hide( )" method in web applications.
I find it very very strange that you didn't know what type of application you were developing.
The other thing is that the Dispose method is used for cleaning up any resources that the object uses. You aren't supposed to be doing any sort of "saving" in the dispose method because it isn't meant for this purpose....it's supposed to clean up resources like database connections etc.
A better solution would have been to have an exit button on the page (disable the X in the corner)...- You would create a custom class used to contain the information gathered on the form.
- You would create a custom EventArgs class that would have a property that takes the custom class I mentioned above.
- You would raise an event in the "exit button" code that would indicate that the form is closing.
- You would use the custom EventArgs class to pass the custom class containing the information as the "e" parameter when you raised the event.
- You would handle the custom event thrown in the parent page..where you could retrieve the custom object containing the information gathered on the form.
-FrinnyComment
Comment