Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
How to pass data between two forms. One form is acting as a parent form and another form is a child form which is opened on button click event.I want to send some data from child form to already opened parent form . It is not an mdi apllication.Help me please.
Thanks,
Minakshi.
Posted

Here[^] is an article which describes different techniques for passing data between forms. :)


wrote:
I want to send some data from child form to already opened parent form


You can find simple solution to this problem by using the "Object Approach" described in the article. The sample code there is for passing data from parent to the child, but it is very easy to pass data from child to parent, using the described approach. Give it a try! :)
 
Share this answer
 
v2
i think you can easily access data of the child form by using object of that form

for example
childform.controlid
or
childform.object
 
Share this answer
 
Off the top of my head, you could:

  1. Add a public property to the child form.
  2. Return data from a ShowDialog method.
  3. Pass a delegate to the constructor of the child form that the child form calls.
  4. Subscribe to an event on the child form.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900