Good morning !!
I have several checkboxes inside the same form in GroupBoxes separated by question. I would like to scan all of those checkboxes that are inside the GroupBoxes where if checked S will not receive N and the result will be in a concatenated String.
Example:
3 yes, 4 no: String result="SSSNNNN".
I have tried in many ways, one of them was:
private void button1_Click(object sender, EventArgs e)
{
String meat = "";
foreach (Control gb in this.Controls)
{
if (gb is GroupBox)
{
foreach (Control chk in gb.Controls)
{
if (chk is CheckBox)
{
CheckBox c = chk as CheckBox;
if (c.CheckState == CheckState.Checked)
{
meat += "S";
}
else
{
meat += "N";
}
MessageBox.Show(meat);
}
}
}
}
}**
But the result comes out letter by letter and not all together.