Android Question How do I check a button through a variable?

Mohamed Akbarally

Member
Licensed User
Longtime User
For example I have a buttons:
Private Button1 As Button
Private Button2 As Button
and I have a variable
Dim x as int = 1

How do I Msgbox button(x)?
 

udg

Expert
Licensed User
Longtime User
Hi Mohamed,
I did't fully understand your goal, but here you are with a couple of alternatives.

1. You could define an array of buttons and then access the one you are interested in by the variable X that behaves as the array index.
2. You could set the TAG property to a different value in each button (e.g. 1,2,3..) and then use the GetAllViewsRecursive function of the container view to search for the button you are interested in, comparing the x var to the value stored in each view (as button) Tag property.

Try experimenting a bit and you'll find the optimal solution for your problem.

udg
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…