Then, I am adding columns to the ListBox via clicking a Button.
I use the following code in the CellBackgroundPain to paint the ListBox’s background
If row Mod 2 = 0 Then
g.ForeColor= &cD2FFF3
Else
g.ForeColor= &cD2EDF5
End If
g.FillRect(0, 0, g.Width, g.Height)
The code itself works fine. The only problem is that I cannot see how many rows I have added.
Is there any way to apply the code above only to the existing rows? It means that the ListBox would have white background, and when I add rows, their background would be painted with the code above?
To be able re-arrange the rows in the ListBox, I created a checkbox called “Sort Rows” and changed the code above to the following code
if CheckBox1.Value=False then
Me.CellType(row, column) = ListBox.TypeEditable
Me.EditCell(row, column)
else
Me.CellType(row, column) = ListBox.TypeNormal
end
Everything works so far - I can create rows, edit each cell within the listbox, and re-arrange the order of the rows when the checkbox is checked.
Is this the best way to make the rows re-arrangeable?