I'm trying to populate some labels and trackbars inside a groupBox. I'm using a List to define the count of them. But i'm having trouble to placing them correctly. This form will be a simple poll about personnel and when i select a personel from comboBox, questions will be pulled from a csv file and stored in a List to use in several parts of program.
Here's my current code:
private void InitializeUI()
{
pList = Database_IO.ParsePersonelData();
fList = Database_IO.ParseFactorData();
foreach (Personel p in pList)
{
personelCB.Items.Add(p.personelName + " " + p.personelSurname);
}
List<Label> labels = new List<Label>();
List<TrackBar> tBars = new List<TrackBar>();
foreach (Factor f in fList)
{
Label l = new Label
{
Text = f.factorName
};
labels.Add(l);
this.Controls.Add(l);
l.Parent = evalGroup;
TrackBar t = new TrackBar();
tBars.Add(t);
this.Controls.Add(t);
t.Parent = evalGroup;
}
}
And this is what i'm trying to do. Dynamically. How can i achieve this?