Hello,
I’v got zebra on my WebListBox when I try this code on the opening event of the weblist control when using a loop
// Fill projects list
Var items() As Repository.Project = Repository.Project.All
// Clear
Me.RemoveAllRows
// Works fine
Me.AddRow("Test 1")
Me.AddRow("Test 2")
For i As Integer = 0 To items.Count-1
Me.AddRow("i " + i.ToString)
Next
// Works fine
Var t As Repository.Project
t = items(0)
Me.AddRow(t.name)
t = items(items.Count-1)
Me.AddRow(t.name)
// Doesn't work
For i As Integer = 0 To items.Count-1
Var p As Repository.Project
p = items(i)
Me.AddRow(p.name)
Next
If I comment the last part of my code, this works fine:
Project is a Class with a single property (name as string). It’s part of Repository Module. And the shared method Repository.Project.All is a simple method to query a mysql Database like this:
Var results() As Project
if Session.db = Nil Then
MessageBox("Connection to database failed.")
Return results
End If
Var sql As String
sql = "SELECT * FROM Project"
Var data As RowSet
Try
data = Session.db.SelectSQL(sql)
Catch e As DatabaseException
MessageBox("DB Error: " + e.Message)
Return results
End Try
If data <> Nil Then
For Each row As DatabaseRow In data
Var item As new Project
item.name = row.Column("name").StringValue
results.Add(item)
Next
data.Close
End If
Return results
Note the same code with db property stored in app works fine in a Desktop Application
3 posts - 2 participants