ArrayList with UserControl
I have a UserControl that has textbox, labels etc in it.
This control can be added to the form one below the other via
Form Load_Event
{
for (int i = 0; i <5; i++)
{
UserControl1 u1 = new UserControl1();
u1.Location = new Point(70, (125 + (i * 23)));
this.Controls.Add(u1);
}
}
Same thing I want to use a ArrayList so I tried this,
List<UserControl1> array_list = new List<UserControl1>();
UserControl1 uc1 = new UserControl1();
To add the UserControl1 to form I again used a for loop
for (int i = 0; i <5; i++)
{
array_list[i].Add(uc1);
array_list[i].Location = new Point(70, (125 + (i * 23)));
}
But this gives me an ERROR
UserControl1' does not contain a definition for 'Add'
How can I add UserControl to form, one below the other using
ArrayList?
|