473,657 Members | 2,428 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 1276
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
2254
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 is to ensure that no child window can close while it is in a state where user entered information can be lost. I have just noticed that while the Closing event is caught if I click the X on the child window, it is not caught if I click the X on...
1
1309
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. If I close/reopen the form the data then is correct.
22
7565
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 otherwise it cancels the close. However, the user can still right click on the task bar and close my application. Is there any way of preventing this. Thanks Alex
6
3223
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
1460
by: Brad Allison | last post by:
Is there an easy way to close one form when another opens? Thanks for the information. Brad
10
4008
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
2
1144
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 the form using the appropriate button Exit (a button built on the form). How can I link a click on Exit to set e.cancel = false, keeping it true
2
3017
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 and then attempts to close the window (either via my custom 'Close' box or by clicking the close 'X' in the upper right window corner), the validation event still triggers and it tells the user that they have invalid data. Which of course means...
4
7704
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
3357
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 I'll make the inactive forms invisible but this is creating a memory corruption problem when user close the form2 or form3 and not the formMain. My main form has a Next button which makes the main form invisible and starts a new form which I'll...
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.