I use this and the compare doesn't work (1,2,3,4... is in the tag of some of the views):
But if I punt j into an implicit string variable a la:
then no problem. I'm not really understanding why, and I can't find a CAST or CSTRING function that I would figure would be integral to situations like this.
What is happening that I'm missing about implicit casts here?
B4X:
Dim j As Int
For j = 1 To labels.Size
For i = 0 To pnlAdd.NumberOfViews-1
If pnlAdd.GetView(i).tag=j Then '<----Won't compare as string
pnlAdd.GetView(i).Visible= True
Dim b As Label
b= pnlAdd.GetView(i)
b.Text=labels.GetKeyAt(j-1)
End If
Next
Next
But if I punt j into an implicit string variable a la:
B4X:
Dim j As Int
For j = 1 To labels.Size
For i = 0 To pnlAdd.NumberOfViews-1
Dim tagtest As String
tagtest=j
If pnlAdd.GetView(i).tag=tagtest Then 'Works, praise be to Murphy
pnlAdd.GetView(i).Visible= True
Dim b As Label
b= pnlAdd.GetView(i)
b.Text=labels.GetKeyAt(j-1)
End If
Next
Next
then no problem. I'm not really understanding why, and I can't find a CAST or CSTRING function that I would figure would be integral to situations like this.
What is happening that I'm missing about implicit casts here?
Last edited: