ccfriend
February 17th, 2006, 12:03 PM
Hi
I have one main Form1 which contains a button that call ShowDialog () to show a new Form2. In this new Form2 I have a Label, a Textbox and a Button. I write something in Textbox and that is copied in the Label after I push the Button. When I close the Form2 and reopen it, the text in Label has been lost (of course). The more simple solution is to store the text in a static string and Load it in Label when Form2 loads.
Is this the best way to maintain data between forms, by using static fields?
If I have more complex Controls like a TreeView I must save and store all the data in static variables?
Is there any other way to handle it? (it would be great if a .NET class can handle this automatically)
Thanks!!!!!!!!!!!
I have one main Form1 which contains a button that call ShowDialog () to show a new Form2. In this new Form2 I have a Label, a Textbox and a Button. I write something in Textbox and that is copied in the Label after I push the Button. When I close the Form2 and reopen it, the text in Label has been lost (of course). The more simple solution is to store the text in a static string and Load it in Label when Form2 loads.
Is this the best way to maintain data between forms, by using static fields?
If I have more complex Controls like a TreeView I must save and store all the data in static variables?
Is there any other way to handle it? (it would be great if a .NET class can handle this automatically)
Thanks!!!!!!!!!!!