|
-
Mar 26th, 2007, 03:09 AM
#1
Thread Starter
Addicted Member
problem in creating textbox at runtime
hi to all,
i am creating the textbox at runtime. the code is like that,
int xpoint1 = 147
int xpoint2 = 289
int ypoint1 = 76
int ypoint2 = 76
int size1 = 102
int size2 = 20;
TextBox txtvalue11 = new TextBox();
txtvalue11.Name = "value1" + intvar;
txtvalue11.Size = new Size(size1, size2);
txtvalue11.Location = new Point(xpoint1, ypoint1);
txtvalue11.Visible = true;
this.groupBox3.Controls.Add(txtvalue11);
i need to access the neewly(runtime) created textbox. how can i access the textbox. i have tried one way, in that,i am storing the textbox name in the arraylist. the code is
TextBox txt=(System.Windows.Forms.TextBox(arrlist[i].toString());
its giving the error " Unable to convert string to textbox";
how can i solve the problem, plz somebody help me to solve the problem.
thank u.
with thanks and regards
mmary
-
Mar 26th, 2007, 11:58 AM
#2
Re: problem in creating textbox at runtime
Remove the ".ToString()" call when you're retrieving the textbox from the arraylist:
Code:
TextBox txt = (TextBox) arrlist[i];
-
Mar 26th, 2007, 04:52 PM
#3
Re: problem in creating textbox at runtime
You shouldn't be storing the Name of the TextBox in this ArrayList. You should be storing the TextBox itself. Then you can do what axion_sa suggests to retrieve it.
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
|