Passing Data Betwen Forms
-
Hi everyone. I'm new to programing and i have a question. I have a winforms mdi application. Let's say my parent form is form1. From form1 a call a child (form2) and i want to use a DataTable from form1 in form2. Ok i'ved made a reference to form1 in form2. But my question is: I have a form3 being called from form2 and in that form3 want to update data in the DataTable from form1. How can i make this? :doh: Thanks in advance. :)
-
Hi everyone. I'm new to programing and i have a question. I have a winforms mdi application. Let's say my parent form is form1. From form1 a call a child (form2) and i want to use a DataTable from form1 in form2. Ok i'ved made a reference to form1 in form2. But my question is: I have a form3 being called from form2 and in that form3 want to update data in the DataTable from form1. How can i make this? :doh: Thanks in advance. :)
You should use properties, events and that kind of stuff for that.
-
Hi everyone. I'm new to programing and i have a question. I have a winforms mdi application. Let's say my parent form is form1. From form1 a call a child (form2) and i want to use a DataTable from form1 in form2. Ok i'ved made a reference to form1 in form2. But my question is: I have a form3 being called from form2 and in that form3 want to update data in the DataTable from form1. How can i make this? :doh: Thanks in advance. :)
You might want to read this[^] little article.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Hi everyone. I'm new to programing and i have a question. I have a winforms mdi application. Let's say my parent form is form1. From form1 a call a child (form2) and i want to use a DataTable from form1 in form2. Ok i'ved made a reference to form1 in form2. But my question is: I have a form3 being called from form2 and in that form3 want to update data in the DataTable from form1. How can i make this? :doh: Thanks in advance. :)
Ice_LS00 wrote:
Ok i'ved made a reference to form1 in form2
Don't ever do that. Use delegates.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Ice_LS00 wrote:
Ok i'ved made a reference to form1 in form2
Don't ever do that. Use delegates.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Thank you guys. Delegates..... How did i never tought on that.... :) You just rocked my world :omg: But i still have a doubt. I have read the article about the delegates and found it very useful, but it doesn't solves my problem. I have a frmMain that calls a child. That childs calls a new child and in that second child i need to update the main. Like this (frmMain - calls - frmChild1 - calls - frmChild2 - updates - frmMain). Does any one know how to resolve this? Thanks in advance.
modified on Tuesday, April 15, 2008 7:03 AM