Dynamic Control creation
-
I have a Panel wherein i place textboxes dynamically. I have set AutoScroll property for the Panel to true. So when the size exceeds automatically Vertical Scroll bar appears. I place dynamic textboxes in sequential order i.e one after the other row wise. I calculate the exact Location and place the control. This works fine. The problem happens when i use the scroll bar to scroll down and then add few more TextBoxes. Now the location of the new added Text Box after scroll is not properly placed. Eventhough the calculation is the same. There is more gap between the previous and the next TextBox control. Why?
-
I have a Panel wherein i place textboxes dynamically. I have set AutoScroll property for the Panel to true. So when the size exceeds automatically Vertical Scroll bar appears. I place dynamic textboxes in sequential order i.e one after the other row wise. I calculate the exact Location and place the control. This works fine. The problem happens when i use the scroll bar to scroll down and then add few more TextBoxes. Now the location of the new added Text Box after scroll is not properly placed. Eventhough the calculation is the same. There is more gap between the previous and the next TextBox control. Why?
-
Hi, First you should set the position of the Vertical Scroll into "0", then add the controls to the panel. Now it works fine. this.panel1.VerticalScroll.Value = 0; this.panel1.Controls.Add(objTextBox); Regards,
Gopal.S