markftwain
Technical User
- Jul 12, 2006
- 108
Hi experts,
Newbie question: How do I return a new object from a child window back to the calling window? (The child window is to perform edits on the object but only keep those edits if user presses <save>, othewise, no editing is to be kept). I am sure this is done often.
I am using C# with .Net 4.0 and visual studio 2010 on windows 7.
My first window creates an object as:
myclass o1= new myclass();
Then calls window_2 as:
window2 w2= new window2( ref o1);
in the initialization code for window2, I have:
p1 = o1;
where p1 in the window2 class defintion was declared as:
public myclass p1;
Window2 now creates a new object n1 based on the information obtained from p1/o1 and allows the user to edit the new object n1 (of same class). When the user presses <save> in window2, I am trying to pass the new object n1 (created in window2) back to the calling routine of window 1, so in the save_click of window2, I put:
p1=n1;
When window2 is now unloaded, window1 is NOT receiving the newly created object n1, but rather still has the original o1.
How is this done correctly?
Any help is very much appreciated. Thank you.
Newbie question: How do I return a new object from a child window back to the calling window? (The child window is to perform edits on the object but only keep those edits if user presses <save>, othewise, no editing is to be kept). I am sure this is done often.
I am using C# with .Net 4.0 and visual studio 2010 on windows 7.
My first window creates an object as:
myclass o1= new myclass();
Then calls window_2 as:
window2 w2= new window2( ref o1);
in the initialization code for window2, I have:
p1 = o1;
where p1 in the window2 class defintion was declared as:
public myclass p1;
Window2 now creates a new object n1 based on the information obtained from p1/o1 and allows the user to edit the new object n1 (of same class). When the user presses <save> in window2, I am trying to pass the new object n1 (created in window2) back to the calling routine of window 1, so in the save_click of window2, I put:
p1=n1;
When window2 is now unloaded, window1 is NOT receiving the newly created object n1, but rather still has the original o1.
How is this done correctly?
Any help is very much appreciated. Thank you.