I need to convert int and or bool to checkState
int ValueCheck;
private void gsCheck1_CheckedChanged(object sender, EventArgs e)
{
CheckBox box = sender as CheckBox;
box.CheckState = ValueCheck; // doesn't work
this.gsCheck2.CheckState = ValueCheck; // should be 1 or 0 ?
}
As you can see I want to change (this.gsCheck2) CheckState by changeing (this.gsCheck1) CheckState and end up with a integer value which is need.
Update.... problem solved
private int ValueCheck(CheckState Check)
{
if (Check == CheckState.Checked)
return 1;
else
return 0;
}
private void gs_CheckedChanged(object sender, EventArgs e)
{
CheckBox box = sender as CheckBox;
MessageBox.Show(box.Name + "="+ ValueCheck(box.CheckState).ToString());
}