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

Edited 6 Years Ago by GAME: n/a

Add a public function in Child form

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

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

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

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;
}

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

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;

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

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

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 6 Years Ago by GAME: n/a

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 article has been dead for over six months. Start a new discussion instead.