hello
I am writting a web browser with tabs
I have a problem in Accessing Controls in the tab which created on runtime
see this Code
private void button4_Click(object sender, EventArgs e)
{
TabPage t = new TabPage();
t.BackColor = System.Drawing.Color.AliceBlue;
t.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
// webBrowser1
//
string name = "http://" + sitename.Text;
WebBrowser wb = new WebBrowser();
wb.Location = new System.Drawing.Point(7, 58);
wb.MinimumSize = new System.Drawing.Size(20, 20);
wb.Name = "webBrowser1";
wb.Size = new System.Drawing.Size(660, 346);
wb.TabIndex = 0;
// bt1
//
Button bt1 = new Button();
bt1.Location = new System.Drawing.Point(371, 29);
bt1.Name = "bt1";
bt1.Size = new System.Drawing.Size(75, 23);
bt1.TabIndex = 1;
bt1.Text = "Start";
bt1.UseVisualStyleBackColor = true;
//
// bt2
//
Button bt2 = new Button();
bt2.Location = new System.Drawing.Point(471, 29);
bt2.Name = "bt2";
bt2.Size = new System.Drawing.Size(75, 23);
bt2.TabIndex = 2;
bt2.Text = "Pause";
bt2.UseVisualStyleBackColor = true;
//
// bt3
//
Button bt3 = new Button();
bt3.Location = new System.Drawing.Point(574, 29);
bt3.Name = "bt3";
bt3.Size = new System.Drawing.Size(75, 23);
bt3.TabIndex = 3;
bt3.Text = "End";
bt3.UseVisualStyleBackColor = true;
//
// lb1
//
Label lb1 = new Label();
lb1.AutoSize = true;
lb1.Location = new System.Drawing.Point(20, 12);
lb1.Name = "lb1";
lb1.Size = new System.Drawing.Size(40, 16);
lb1.TabIndex = 4;
lb1.Text = "name";
//
// lb2
//
Label lb2 = new Label();
lb2.AutoSize = true;
lb2.Location = new System.Drawing.Point(40, 34);
lb2.Name = "lb2";
lb2.Size = new System.Drawing.Size(33, 16);
lb2.TabIndex = 5;
lb2.Text = "num";
//
t.Controls.Add(lb1);
t.Controls.Add(lb2);
t.Controls.Add(bt1);
t.Controls.Add(bt2);
t.Controls.Add(bt3);
t.Controls.Add(wb);
t.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
t.Location = new System.Drawing.Point(4, 22);
t.Padding = new System.Windows.Forms.Padding(3);
t.Size = new System.Drawing.Size(678, 421);
t.Name = i.ToString();
t.Text = sitedes.Text;
tabControl1.TabPages.Add(t);
i++;
int m = (int.Parse(numopen.Text)+1);
numopen.Text = m.ToString();
numrun.Text = m.ToString();
try { wb.Navigate(new Uri(name)); }
catch (System.UriFormatException er) { MessageBox.Show(er.ToString()); }
sitename.Text = "";
sitedes.Text = "";
}
sitename is a textbox on first tab and sitedes so on
the problem as i said i can not know what controls in each tab do and its data
how i can make such as
string xv = tabControl1.TabIndex(2).lb2.Text;
But Not valid experation
Please help me in that problem
thanks
EraMaX