I have a Panel in my Form, and I have a personal UserControl. I want to add in my Panel some instances of this UserControl (one above the other – Y order). I set the Dock property of these controls to Top. Something like the following code
for(int i = 0; i < 10; i++)
{
panel1.Controls.Add(new MyUserControl
{
Dock = DockStyle.Top,
});
}
The problem is that, even if there are more controls than can be displayed, the vertical scrollbar dows not appear. Why? Also the controls are added in reverse order.
How can I solve these problems?
Set the AutoScroll property of your panel to TRUE.