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?