Tony,
You launch form2 from form1 with something like this:
form2.ShowDialog();
What you need to do is add some more code and check for OK or Cancel in the
dialog result. So, make sure your Dialog Result for the Cancel button on
form2 is set Cancel, and the Dialog Result for the OK button is set to OK
(look in the properties under behavior for each button).
Now, when you call form2.ShowDialog() from form1, the ShowDialog() method
will return a DialogResult from form2, use the result like this:
if (form2.ShowDialog() == OK)
{
//DO SOMETHING THAT IS OK TO DO
}
else
{
//CANCEL WAS HIT - or check for explicit values if needed
//set your checkbox to unchecked
this.myCheckBox.Checked = false;
}
Matt
"TonyM" <Bi****@spamsucks.com> wrote in message
news:Ku*********************@news.easynews.com...
Hi Guys,
I just need a push in the right direction here, I'm kinda stuck.
I have a project with multiple Windows Forms launching from the main form
by use of checkboxes. very easy, got that handled.
The problem I have is this: If the "cancel" button is pressed on one of
the spawned forms I can close that form, but I need to uncheck the checkbox on
that was originally checked.
I saw checkBox.CheckState, but since I am operating in another class (say
Form2.cs), how could I manipulate the checkbox that is in Form1.cs and
change the state to unchecked?
I'm sure this is something simple and I'm just suffering from
newbie-itis... but if you have a minute to help I would be most appreciative.
Thanks,
-Tony