Child Form variables postback to MDI Parent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi everybody,

I let the user enter values in a Child Form.
How can I post those values back to the MDIParent Form (which uses these
values) ?

By the way, is it possible to access Public MDIParent variables in a Child
Form ??

Help appreciated,
 
One way would be to use properties. Or you could use return types in your
methods.

It really depends on what you are trying to do.

Bob Calvanese
 
assuming you got 2 forms:
frmPost
frmInput (has public control "txtName" and "txtMail")
then in frmPost you can get value of "txtName"or"txtMail" by this:
private void btn_Click(object sender, System.EventArgs e)
{
frmInput myForm=new frmInput ();
myForm.ShowDialog(this);
this.user_name=myForm.txtName.Text;
this.user_mail=myForm.txtMail.Text;
}
 
and if you want to access Public MDIParent variables in a Child Form,you
should declare a public static variable in MDIParent:
public static bool hasChild;
then you can access it from Child:
MDIParent.hasChild=true;

----- Original Message -----
From: "Philippe" <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Wednesday, March 16, 2005 7:57 AM
Subject: Child Form variables postback to MDI Parent
 
When working with objects you should not directly expose your member
variables. If that was not the case... Why not just make everything public?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top