Use a separate
Public Property
for each variable you want to pass between forms or create one Structure to hold all the variables and use a
Public Property
to pass the Structure.
Form1
* Declare the Properties (Below is an example of a date property)
public System.DateTime Stop_Time {
get { Stop_Time = m_stop_time; }
set { m_Stop_Time = value; }
}
System.DateTime m_Stop_Time;
* Set the Properties before instantiating Form2
* Instantiate and Show Form2
* After Form2 closes, use properties to change form fields in Form1
Form2
* In Form Load Event, use Public Properties from Form1 to initialize Form2's controls
* In the Close Event, use Form2's controls to change Form1's Public Properties