I have 10 RadioButton inside a panel.
I have 10 panels inside a tableLayoutPanel, Each one in different column.
How can i move between the columns and validate that in each column there is a selected radioButton?
Thank you.
I have no experiences with the TableLayoutPanel
, but you could try this:
bool allValid = true;
for(int c = 0; c < panel.ColumnCount; c++)
{
var colRadios = panel.Controls.OfType<RadioButton>()
.Where(rb => panel.GetColumn(rb) == c);
bool colValid = colRadios.Any(rb => rb.Checked);
if(!colValid)
{
allValid = false;
break;
}
}
( panel
is the TableLayoutPanel
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.