Compile error with For ... Next statement

rafpic62

New Member
Licensed User
Longtime User
I have the following issues with For ... Next.

Please look at the following code:

Code example 1:

Sub Activity_Create(FirstTime As Boolean)
Dim s As String
Dim i As Int
Activity.LoadLayout("1")
ListView1.Clear

For i = 1 To 34
s = NumberFormat(i,0,0)
ListView1.AddSingleLine("Parte " & s) //this is line 24
Next i

End Sub

when compiling there's following error:

Compiling code. 0.02
Generating R file. 0.00
Compiling generated Java code. Error
B4A line: 24
ListView1.AddSingleLine(\
javac 1.6.0_25


If I use a Do While ... Loop instead it compiles correctly:

Code example 2:

Sub Activity_Create(FirstTime As Boolean)
Dim s As String
Dim i As Int
Activity.LoadLayout("1")
ListView1.Clear

i = 1
Do While i <= 34
s = NumberFormat(i,0,0)
ListView1.AddSingleLine("Parte " & s)
i = i+1
Loop

End Sub

Anyone can suggest me why this happen ?

Thank you
 
Top