Click here to Skip to main content
15,936,362 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:

I have 2 forms in which i enter some data in textBox, comboBox, etc.,
When i go to second form and come back to first form, all the data which i entered are refreshed. i.e., Form1 has no values.
Someone please help me displaying those values in form1 when i move from FORM2 to FORM1.
Sergey Alexandrovich Kryukov 25-May-11 1:41am    
Oh... Tag it! Forms or ASP.NET or what?
Deepurs 25-May-11 2:27am    
Windows Forms
Sergey Alexandrovich Kryukov 25-May-11 4:00am    
So tag it! Use "Improve question". Look, you're the one who need it.

Another way is to keep the Form1 is memory ( instead of Form1.close , invoke Form1.Hide) and show it back by using Form1.Show as an when required.
Share this answer
you can store that value in settings... for that
open your project properties....
select Settings tab and enter your variable name, Data Type of variable and select scope as user and last if you want give any default value then give it...
after that create one property to access that variable create this property in both form or you can create one static property for that in common static class...
public string FirstValue
    get { return Properties.Settings.Default.DestinationPath; }
         if (value != Properties.Settings.Default.FirstValue)
             Properties.Settings.Default.FirstValue = value;

create other variables as per need of your application...
and access it directly or use it through property that you have created before...
now you can access this variable from any form of your application...
Thanks & Regards,
Punit Parmar
Share this answer
parmar_punit 25-May-11 5:14am    
I don't know why it is down voted...
This is better way instead hiding the form because there is more forms in application then hiding forms still occupy the memory, so application will be heavy loaded to memory... if you save some required value and close the form then it will take less memory to run application....
I think its better way then hiding the form.....
The best way to form collaboration is implementing appropriate interface by the form class.
Please see the details in my past solution, see also other solutions and discussion:
How to copy all the items between listboxes in two forms[^].

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