I have done some research on this question before deciding to ask it. I just could not find anything that helped me.
I am writing an application in C# for the compact framework 2.0.
I need to take a data object instantiated on form1 and pass that object a form2. Work on the data object in form2 and then pass that data back to form1 so it can be saved.
I understand that a form is just an object an I also understand that objects are past by reference and not by value. I also understand the difference between the two types. I just cannot make it work for some reason.
What is the best, and cleanest, way in code to achieve this?
What you need to do is create a second constructor to your second form that accepts an object as a parameter… for all I care, it could be the entire Form1 object instance, then you can get whatever you want from it. Preserve this object in your second form and modify it as needed there. Upon completion of your second form, your first form will have that data and you can do whatever “refreshing” once the second form closes.