Android Question Representing a LABEL with a variable

AlexOfOz

Active Member
Licensed User
Longtime User
I'm sure it is simple, but I am stumped after days of trying to work it out.

I am trying to represent a LABEL with a variable. The LABEL name is "lblOne" and I am trying to represent this with a variable such as "blank". But when I then try to read the LEFT value of the label with "blank.Left", I am being told that LEFT is not recognised. So obviously the compiler is not seeing the variable as containing the name "lblOne". It must be seeing it purely as a string.

What do I need to do to have the compiler recognise that "blank" now contains the label's name?
 
If you have declared "blank" As Object then that would be your problem. You would need to declare it As Label or at a minimum As View if you wish to access the .Left property.
 
Upvote 0
If you have declared "blank" As Object then that would be your problem. You would need to declare it As Label or at a minimum As View if you wish to access the .Left property.
Thanks Jeffrey, that is likely to be the problem. I have declared "blank" as STRING. I'll change it to be LABEL and see how that goes. Appreciate your help.
 
Upvote 0
I have solved the problem - my logic was all wrong. I didn't need to replace the object name with a variable at all.

This forum is great. I hope one day to be able to help others like you guys'n'gals are helping me.
 
Upvote 0
Back
Top