// Initialize a new textbox
TextBox txt = new TextBox();
// Set the dimension and location
txt.Top = 10;
txt.Left = 10;
txt.Width = 100;
txt.Height = 25;
// Set the visibility and add it to the form
txt.Visible = true;
Save all the controls with their properties in a text file and load the control at runtime.....
I have attached a solution that uses a simple logic to create textbox at runtime. The program stores the no of textboxes created in a file. And on page load, reads the file and creates the textboxes.
This may not fit your situation but give u an idea on how to continue....
The attached file is just my way of implementing your idea. There are ofcourse many other effective algorithm available
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...