Reputation: 11
How can I do so only one box can be selected at the same time?
foreach (var i in contestlist)
{
CheckBox cnb = new CheckBox();
cnb.Text = i.Name;
cnb.Location = new Point(10, panel1.Controls.Count * 20);
panel1.Controls.Add(cnb);
}
Upvotes: 1
Views: 69
Reputation: 199
If you only want one selected then the case is you want to use radiobuttons instead
If you put radio buttons into a groupbox you can make it so only one can be selected within each groupbox
Upvotes: 3