Using variable names for controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

dim test as string
test="control1"

now, control1 is a textbox

i wanna use the name of the variable i.e. test to get the value of the textbox

i.e. msgbox(test.text)

can any one tell me how to do it?
 
siddahuja said:
dim test as string
test="control1"

now, control1 is a textbox

i wanna use the name of the variable i.e. test to get the value of
the textbox

i.e. msgbox(test.text)

can any one tell me how to do it?

MsgBox Me.Controls(test)

You don't want to use the Text property except in special circumstances as
that is the changed (but not yet updated) entry in the control with focus.
The Value property is the default and is what you would normally use.
 
Back
Top