mrossen Active Member Licensed User Longtime User Dec 22, 2011 #1 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 Code: Copy Dim RadioButtonDevice(0) As RadioButton Dim RadioButtonDevice(1) As RadioButton Dim RadioButtonDevice(2) As RadioButton If RadioButtonDevice(0).Checked Then Common End If Mogens
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 Code: Copy Dim RadioButtonDevice(0) As RadioButton Dim RadioButtonDevice(1) As RadioButton Dim RadioButtonDevice(2) As RadioButton If RadioButtonDevice(0).Checked Then Common End If Mogens
thedesolatesoul Expert Licensed User Longtime User Dec 22, 2011 #2 Yes, you can create arrays of views. Code: Copy Dim LabelArray(5) as Label LabelArray(0).Text = "0" Have a look at this example: http://www.b4x.com/forum/basic4andr...-tack-toe-working-arrays-views.html#post47508 Upvote 0
Yes, you can create arrays of views. Code: Copy Dim LabelArray(5) as Label LabelArray(0).Text = "0" Have a look at this example: http://www.b4x.com/forum/basic4andr...-tack-toe-working-arrays-views.html#post47508
mrossen Active Member Licensed User Longtime User Dec 22, 2011 #3 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
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
klaus Expert Licensed User Longtime User Dec 22, 2011 #4 It's possible, but a little bit more complicated than in VB6. Code: Copy ' 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
It's possible, but a little bit more complicated than in VB6. Code: Copy ' 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.