0
Good morning!!
I have several checkboxes within the same form in Groupboxes separated by second. I would like to scan all these checkboxes that are inside the groupboxes where if checked receive S if not receiving N and the result, stay in a concatenated string.
Example:
3 yes, 4 no: String result = "SSSNNNN".
I’ve tried several ways, one of her 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.