Alright, I was a PHP and flash developer before .NET, and so I am used to using dynamic variables in loop situations like these. But let me explain what I'm trying to do.
Basically, there is a custom control that loops through a List<Product> when it is received, and displays smaller "UserContro l2" controls for every product in that list. However, when I run this code for some reason, the UserControl2 objects do not show up. No idea why. Here's the method:
private List<UserContro l2> controlist = new List<UserContro l2>();
public void SetProductSourc e( Product[] ProductSource )
{
for (int ii = 0; ii < ProductSource.L ength; ++ii)
{
UserControl2 newcontrol = new UserControl2();
newcontrol.Name = "NewControl " +ii.ToString();
newcontrol.Loca tion = new Point( 0, (HeightPerItem + ItemSpacing) * ii );
newcontrol.Size = new Size( 676, 158 );
newcontrol.SetP roduct( ProductSource[ii] );
newcontrol.Visi ble = true;
newcontrol.Brin gToFront();
controlist.Add( newcontrol );
}
}
Basically, there is a custom control that loops through a List<Product> when it is received, and displays smaller "UserContro l2" controls for every product in that list. However, when I run this code for some reason, the UserControl2 objects do not show up. No idea why. Here's the method:
private List<UserContro l2> controlist = new List<UserContro l2>();
public void SetProductSourc e( Product[] ProductSource )
{
for (int ii = 0; ii < ProductSource.L ength; ++ii)
{
UserControl2 newcontrol = new UserControl2();
newcontrol.Name = "NewControl " +ii.ToString();
newcontrol.Loca tion = new Point( 0, (HeightPerItem + ItemSpacing) * ii );
newcontrol.Size = new Size( 676, 158 );
newcontrol.SetP roduct( ProductSource[ii] );
newcontrol.Visi ble = true;
newcontrol.Brin gToFront();
controlist.Add( newcontrol );
}
}
Comment