473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Closing a form but keeping the information in the form

4 New Member
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?
Apr 28 '10 #1
5 1269
yarbrough40
320 Contributor
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.
Apr 28 '10 #2
bjstone15
4 New Member
I guess a web app
Apr 28 '10 #3
bjstone15
4 New Member
I think is has to do something with the form just being hidden, so I have been trying a Me.Refresh but with little success.
Apr 28 '10 #4
bjstone15
4 New Member
Hey! I figured it out, it's a Me.Dispose()

Thanks for your help anyways!
Apr 28 '10 #5
Frinavale
9,735 Recognized Expert Moderator Expert
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.

-Frinny
May 4 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2231
by: Ron L | last post by:
I have an MDI application with a number of child windows. In each child window I am catching the Closing event and having the child window decide if it should set cancel to true. The intent here...
1
1299
by: pdemarais | last post by:
What is the differance between refreshing a form and closing/reopening a form. When I refresh data in a form and click on a record in a list box the information that shows is from the 1st record....
22
7526
by: alecjames1 | last post by:
I have a form which the user must complete before closing. I have disabled the window x button and use my own exit button. When selected it checks to see if the user has completed the entries...
6
3214
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
3
1451
by: Brad Allison | last post by:
Is there an easy way to close one form when another opens? Thanks for the information. Brad
10
3983
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
1140
by: N! Xau | last post by:
Hi, I want to avoid an user closes the form clicking on the upper right side "X" button. So, for the Closing event, I set: e.cancel = true The problem is, this way the user can't even close...
2
3001
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
4
7680
by: Academic | last post by:
I read the Help and some of the many Google hits I got but can't find out the difference between MyBase.Closing and MyBase.FormClosing Can anyone tell me? Thanks
14
3333
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.