Dynamically set properties of a label at run time
Posted on 2007-04-07
I have a vb6 projects with numerous forms and numerous labels on the form. At run time I want to dynamically be able to set the properties of each lablel i.e. .caption = "XY"
Each label will have a default value for each property that is hardcoded into app, however on a dymanic basis I want to be able to provide a new property value. Because there are so many labels and forms I don't want to have to programatically put a line in the code for each property. I simply want a function that I can pass the form to, then the function will change the label properties, by looking up the labels new properties in a SQL table. I thought you could do it with something similar to the following:
Dim lblDynamicLabel as Object
lblDynamicLabel = "lblObjectName"
lblDynamicLabel .caption = "GGG"
However this throws an error.