Good night friends, I want to do the following, I have a (for) loop that adds records in a listview, I want to lock this loop in 15 records as I do this.
Follow the code in my loop ...
B4X:
c=s.ExecQuery("SELECT CODBARRAS,QUANTIDADE FROM PRODUTOS ORDER BY CODBARRAS")
Lvadiciona.Clear
If c.RowCount >0 Then
For i=0 To c.RowCount-1
c.Position=i
Lvadiciona.AddTwoLinesAndBitmap(C.GetString ("CODBARRAS"), C.GetString ("QUANTIDADE"),LoadBitmap(File.DirAssets,"icone_lixeira6.jpg"))
Next
End If
End If
If the records obtained are less than 15 then loads all read records.
If they are more than 15 stops at record 14, which would be the 15th
B4X:
c=s.ExecQuery("SELECT CODBARRAS,QUANTIDADE FROM PRODUTOS ORDER BY CODBARRAS")
Lvadiciona.Clear
If c.RowCount >0 Then
For i=0 To Min(c.RowCount-1,14)
c.Position=i
Lvadiciona.AddTwoLinesAndBitmap(C.GetString ("CODBARRAS"), C.GetString ("QUANTIDADE"),LoadBitmap(File.DirAssets,"icone_lixeira6.jpg"))
Next
End If