Is there a way to dynamically set a control by its name?
for example, I have a form with a custom calendar.
along the y axis i have dates, and along the x axis i have locations.
The locations can be variable, as i can add locations.
(background: e.g i have a storage facility with X locations, and I want to see in a calendar view which location is rented by which client)
My form creates (or removes) textboxes depending on the amount of locations that are defined.
Each textbox has the name set of X-Y (basically the same as top and left values)
I know I can access the textbox by doing
However what I would like to be able to do is:
However when I try to do this, it looks for the field x & "-" & y, instead of their values.
Currently my workaround for this problem is :
However with 30 days and 20 locations, that means looping though 600 boxes....
Does anyone know how to either expand the vars, or to set the control without looping?
Any help is greatly appreciated
for example, I have a form with a custom calendar.
along the y axis i have dates, and along the x axis i have locations.
The locations can be variable, as i can add locations.
(background: e.g i have a storage facility with X locations, and I want to see in a calendar view which location is rented by which client)
My form creates (or removes) textboxes depending on the amount of locations that are defined.
Each textbox has the name set of X-Y (basically the same as top and left values)
I know I can access the textbox by doing
Code:
me.[500-600] = "valuehere"
However what I would like to be able to do is:
Code:
dim x as integer
dim y as integer
x = 500
y = 600
me.[x & "-" & y] = "valuehere"
However when I try to do this, it looks for the field x & "-" & y, instead of their values.
Currently my workaround for this problem is :
Code:
dim ccont as textbox
for each ccont in me.controls
if ccont.left = x and ccont.top = y then
ccont = "valuehere"
exit for
end if
next ccont
Does anyone know how to either expand the vars, or to set the control without looping?
Any help is greatly appreciated