Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i am creating windows application in which i have two forms employee_details and communication_details.i do not use databse. In Employee details form fill up employee details after that i clicked on next button it goes to communication_details form and fill up employee communication data after that i clicked on saved the data must be saved on memory.i am taking too much variable in class file to store data in memory but which is wrong.
Posted
Comments
[no name] 15-Aug-12 9:12am    
Okay so? What is it that you expect from us? There is no question stated, vague description of some sort of a problem, no code for what it is that you are trying to do that you are having a problem with.
Aditya Mangipudi 15-Aug-12 10:57am    
I am not sure why you are not using a database but if you want to store all the data in the memory (please show some code), you need to create an object each for both forms with all the fields.
public class EmployeeData
{
public int Id {get; set;}
public string EmployeeName {get; set;}
....
}

1 solution

The question is unclear and looks naive. You are trying to find an application-specific approach to a very general problem (but anyway don't provide enough information).

Try to think in the following direction: why would you need to save form data, in memory or not? A form is needed not for itself, it plays a role submissive to the semantic of some application, is used just a UI presentation and control; using the form, the user look at data and express the decisions on how to modify the data.

So, first of all, you need to isolate the data from the UI presentation of it. You need to have some data model which stays in memory (in your case; I'm not analyzing applicability of the memory presentation of it, assuming that you are right here) and can persist in one or another way (not always, but otherwise your application could not create or use any data artifacts). The data model (your employees and there relations, communications) should not depend on the UI. Then, you will need to bind this data with your UI somehow. In a simple case, you should have a method of populating the form(s) with data model and a method for updating the data model according to the state of your UI controls.

You need to review your design and start from here. I would suggest you learn and analyze applicability of the following architectural patterns (http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)[^]):

MVVM — Model View View Model,
http://en.wikipedia.org/wiki/Model_View_ViewModel[^],

MVC — Model-View-Controller,
http://en.wikipedia.org/wiki/Model-view-controller[^]),

MVA — Model-View-Adapter,
http://en.wikipedia.org/wiki/Model–view–adapter[^],

MVP — Model-View-Presenter,
http://en.wikipedia.org/wiki/Model-view-presenter[^].
Pay attention for the motivation of those architectures. If you understand it, you would be able to create better design ideas.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900