Views as array

mrossen

Active Member
Licensed User
Longtime User
Hi,

I am wondering if I can use views as arrays.
I can do this in vb6 but can not make it to work in basic4android

I have tried something like this

B4X:
Dim RadioButtonDevice(0) As RadioButton 
Dim RadioButtonDevice(1) As RadioButton 
Dim RadioButtonDevice(2) As RadioButton 

If RadioButtonDevice(0).Checked Then
    Common
   End If

Mogens
 

mrossen

Active Member
Licensed User
Longtime User
Thanks for the quick reply,

I have tried this but can still not get it to work.

How do I name the views in the designer.

Will this be labelarray(0)? I have done this but it is not working.

In vb6 when I use the same name vb6 ask if I will make an array.

Mogens
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
It's possible, but a little bit more complicated than in VB6.
B4X:
' in Globals
Dim rbt0, rbt1, rb2 As RadioButton
Dim RadioButtonDevice() As RadioButton

' in Activity_Create
RadioButtonDevice = Array As RadioButton(rbt0, rbt1, rbt2)

' somewhere
If RadioButtonDevice(0).Checked Then
    ' do something
End If
Best regards.
 
Upvote 0
Top