|
-
Apr 24th, 2003, 09:36 AM
#1
Thread Starter
Member
Dynamically Adding textboxes [Resolved]
Hi, my code creates 10 textboxes, or more if I change the for loop with a variable instead of 10.
All the textboxes are dynamically added. My question is how can I address say the third text box. I.e. in my code I would want to assign different text to each textbox afterwards.
heres my code.
int iLeft = 16;
int iTop = 16;
TextBox txtInput;
for (int i=0;i < 10; i++)
{
txtInput = new TextBox();
txtInput.Location = new Point(iLeft,iTop);
txtInput.Size = new Size(100,35);
txtInput.TabIndex = 1;
txtInput.BorderStyle =0;
txtInput.BackColor = Color.Blue;
txtInput.ForeColor = Color.White;
txtInput.Text = "Input Field #" + i.ToString();
this.Controls.Add(txtInput);
iTop += 30;
}
Last edited by Genie; Apr 28th, 2003 at 09:49 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|