J
jkbat
Hi,
Hoping this isn't too trivial a question:
I have a form with TextBoxes named TextBox1, TextBox2, etc. I'd like to
iterate through a whole series of these and set their values based
(initially) on a counter. I'm thinking I need a way to convert a string
to a control's reference?
What I want to do in (pseudo-ish) code is:
Dim str as String
Dim i as Integer
Do
Me.TextBox(i).Text = i
Loop Until i = 32
I can generate the appropriate string variable with the value I need
i.e.
str = "Me.TextBox" & i & ".Text"
but it's not being picked up as a control reference. I've had a look at
DirectCast, but can't seem to figure it out...
Any ideas?
Cheers,
Jimmy
Hoping this isn't too trivial a question:
I have a form with TextBoxes named TextBox1, TextBox2, etc. I'd like to
iterate through a whole series of these and set their values based
(initially) on a counter. I'm thinking I need a way to convert a string
to a control's reference?
What I want to do in (pseudo-ish) code is:
Dim str as String
Dim i as Integer
Do
Me.TextBox(i).Text = i
Loop Until i = 32
I can generate the appropriate string variable with the value I need
i.e.
str = "Me.TextBox" & i & ".Text"
but it's not being picked up as a control reference. I've had a look at
DirectCast, but can't seem to figure it out...
Any ideas?
Cheers,
Jimmy