Hi,
In one activity, I add, by code, some checkbox as following:
After this code running, some checkbox are set on and some are set off.
Now, I need to create a list with all checked Checkbox.
I've tried to do that:
My problems are:
- In the loop "For Each V As CheckBox In Activity.GetAllViewsRecursive",
it seems all views are taking in account, not only CheckBox view
- for some views (exept CheckBox views), V.tag has no value but this value is not "" or Null
So, what should be the best solution to retrieve the list of CheckBox view in my activity and what about value of tag, only if there is a value ???....
In one activity, I add, by code, some checkbox as following:
B4X:
For i = 1 to 10
Dim Chk As CheckBox
Chk.Initialize("")
Chk.Text = "CH" & i
Chk.Tag = i
Activity.AddView(Chk,2%x,1%y *i,90%x,10%x)
Next
After this code running, some checkbox are set on and some are set off.
Now, I need to create a list with all checked Checkbox.
I've tried to do that:
B4X:
Dim Result as String
For Each V As CheckBox In Activity.GetAllViewsRecursive
If v.tag <> "" or v.tag <> Null Then
If V.Checked = True Then
Result = Result & V.Tag
End If
End If
Next
My problems are:
- In the loop "For Each V As CheckBox In Activity.GetAllViewsRecursive",
it seems all views are taking in account, not only CheckBox view
- for some views (exept CheckBox views), V.tag has no value but this value is not "" or Null
So, what should be the best solution to retrieve the list of CheckBox view in my activity and what about value of tag, only if there is a value ???....