Text Box

If I  know name of textbox .And it's contain in some string.

For example,
dim str1 as String
str1="Text1" ' (Name of TextBox)
Now ,how can I get all the properties of this textbox?
irina_1973Asked:
Who is Participating?
 
prakashbitraConnect With a Mentor Commented:
Me.Controls(str1).Text = <value>

will work try this..
0
 
ventondCommented:
Forget str1.

Text1.text - The visible test
Text1.Backcolor
Text1.Left


etc
0
 
ventondCommented:
To clarify you might say something like

str1 = Text1.Text
or
Text1.Text = str1

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
marconovaroCommented:

You can access the text1 control using the "controls" collection. For instance, if you have a form and a textBox named Text1, you can use something like this:

Me.Controls("Text1").Text = "ABC"

to access the properties of the textbox named "Text1". If you have that name on a string, you can use:

Me.Controls(myStringName).<Property>

Hope this helps....
Marco
0
 
irina_1973Author Commented:
thanks to everybody
0
 
ventondCommented:
Prakashbitra,
   Yes, it will work. But why do all that extra typing?(And make the computer do the extra work?)

0
 
marconovaroCommented:
My answer was correct, too :(
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.