Groups | Blog | Home
all groups > visual studio .net general > may 2006 >

visual studio .net general : How to create TextBox controls in runtime


Hebert
5/29/2006 10:38:38 AM
Hi... I need to know how to create TexBox controls in runtime and also know
how to named each one
For Example>

If I create 5 TextBox controls in runtime... Each of these must be named as:
txt_01_02_I
txt_02_04_I
txt_03_06_I
txt_04_07_I
txt_05_09_I

For me those numbers mean code that then will serve me in order to save the
information that the textbox controls contain

Thanks a lot for their help

Kevin Spencer
5/30/2006 12:00:00 AM
Here's a little trick you can use: In Visual Studio's Windows Forms
designer, add a TextBox to a form visually, by adding it from the toolbox.
Allow it to be named "TextBox1" or just take a note of the name. Then open
the Designer code for the form, which is usally called something like
"Form1Designer.cs" and expand all outlining. Do a Find in the code for all
references to "TextBox1" and copy the code to NotePad. That will be all the
code needed to properly add a TextBox to your form. Modify it for each
TextBox you want to add at runtime. And there you go.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Abnormality is anything but average.

[quoted text, click to view]

AddThis Social Bookmark Button