0

How would I be able to check if a checkbox is checked from a childform and use that information on the parent?

Edited by GAME: n/a

2
Contributors
9
Replies
10
Views
7 Years
Discussion Span
Last Post by finito
0

Add a public function in Child form

bool public GetStatus()
{
  return checkbox1.Checked;
}

And call this function where you have called for Child.Show();

0

I need to check on formload, how would I be able to do that?

0

If you are fetching it in form load did you even check the child form yet wouldn't you get always false? (Unless you set it to be true by default).

Try this in form load.

ChildForm CF =  new ChilForm()
bool StatusCheck;
if (CF.ShowDialog() == DialogResult.OK)
{
   StatusCheck = CF.GetStatus;
}
0

In my program, the user has the ability to use extra things like play sounds when done and show certain windows on startup.

the error I get is

Error	1	Cannot convert method group 'GetStatus' to non-delegate type 'bool'. Did you intend to invoke the method?	C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\iUltimate\iUltimate\Form1.cs	201	28	iUltimate
0

Ok, know Im getting data from parent to a child...


form1 is the parent, form8 is the child, also I need other childs to be able to the same thing a form8....

Form1 frm;
        
        public Form8()
        {
            InitializeComponent();
            frm = new Form1(this);   
        }
public Form8 frm;
        public Form1(Form8 F)
        {
            
            frm = F;
0

Ummm. From Form8 you can simply do Form1.VariableorFunction();

I don't know what you are trying to do up there.

0

Ok, let me say this, I need to transfer data to another form. I cant get my way to work, can you explain your way more?

Edited by GAME: n/a

0

in Parent.

int x = 5;
ChildForm CF =  new ChilForm(x)
bool StatusCheck;
if (CF.ShowDialog() == DialogResult.OK)
{
   StatusCheck = CF.GetStatus;
}

In child

int k;
public ChildForm(int y)
{
   InitializeComponent();
   k = y;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.