WebListBox.RowTagAt() sometimes fails

A very strange bug that took many hours and headache. I fill the Rowtag of the rows in my ProjectListBox (WebListBox) with these lines of code:

sql = “SELECT * FROM projects”
rows = Session.db.SelectSQL(sql)
If rows <> Nil Then
For each row As DatabaseRow In rows
ProjectListbox.AddRow(row.Column(“projectnumber”).StringValue,row.Column(“projectname”).StringValue,username,row.Column(“created”).StringValue,usernamechanged,moddate,row.Column(“id”).StringValue)
ProjectListbox.RowTagAt(ProjectListbox.LastAddedRowIndex) = row.Column(“id”).StringValue
Next
rows.Close
End If

Setting the RowTagAt fails for some rows (but not all) when the Listbox has the order changed after clicking a header, RemoveAllRows, and run this code again (for the second, third time etc). The first run, when no table sorting has done, always fill all RowTags.

When I load the RowTags with additional code after this block of code has processed, than all RowTags are loaded. This is the additional code:

For i As Integer = 0 To ProjectListbox.RowCount -1
ProjectListbox.RowTagAt(i) = “” + ProjectListbox.CellValueAt(i, 6)
Next

I do not want the extra column (6) with database ID’s but rather have the RowTag set when I process the database results. What is wrong?

Can you make a test project to show and report via Feedback?

Hi Christian,

Although I cannot explain, I assume it has to do with the combination of the database functions.
I made a sample project with a data array as a property, but that works. Is there a test database in the Xojo Cloud that I can connect to. I don’t care about the data, a few fields with some strings is enough. Currently I have our Database credentials in the project and I assume the projects can be seen by all Feedback users?

You can define a feedback Case to be visible by Xojo and you only. Of course, it still depends on the kind of your project, if you are even eager to share the creds with Xojo. You could create an own temporary user though.