A set of .NET Framework managed libraries for developing graphical user interfaces.
Thanks to both folks who provided suggestions that furthered progress .....
The way I got it to work (using a tableLayoutPanel for control placement) was to keep controls instance creation consolidated but give each control its own for loop (in case another novice comes looking):
private void SetupMonitoring_Load(Object sender, EventArgs e)
{
int drvs = FoundDrives.Count;
// modify tableLayoutPanel for control placement
DrivesTable.RowCount = drvs;
for (int i = 0; i < drvs - 1; i++)
DrivesTable.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F));
DrivesTable.Size = new Size(530, drvs * 25);
CheckBox[] drvChkBx = new CheckBox[drvs];
Label[] nameLBL = new Label[drvs];
Label[] labelLBL = new Label[drvs];
ComboBox[] roleCBX = new ComboBox[drvs];
Label[] typeLBL = new Label[drvs];
Label[] sizeLBL = new Label[drvs];
Label[] freeLBL = new Label[drvs];
Label[] usedLBL = new Label[drvs];
MaskedTextBox[] factor = new MaskedTextBox[drvs];
SuspendLayout();
int vertSpace = 0;
for (int i = 0; i < drvs; i++)
{
var drv = FoundDrives[i];
drvChkBx[i] = new CheckBox();
drvChkBx[i].Name = $"{drvChkBx}{i}";
nameLBL[i] = new Label();
nameLBL[i].Name = $"{nameLBL}{i}";
nameLBL[i].Text = $"{drv.name}";
// etc.
}
for (int i = 0; i < drvs; i++)
{
drvChkBx[i].Size = new Size(20, 20);
DrivesTable.Controls.Add(drvChkBx[i], 0, i);
}
for (int i = 0; i < drvs; i++)
{
nameLBL[i].Anchor = AnchorStyles.Bottom;
nameLBL[i].ForeColor = Color.FromArgb(0, 0, 192);
nameLBL[i].Size = new Size(30, 20);
DrivesTable.Controls.Add(nameLBL[i], 1, i);
}
// etc.
}