I have a listbox causing a Exception of Class OutofBoundsException Not Handled Error on the Windows build. The listbox is located on a pagepanel tab which is not shown when the app opens; however, as soon as the tab is shown the listbox is drawn causing this error. The Mac build works perfectly. I am testing in XP Pro.
The listbox opens with a default color of white in the column 0 and the other columns are light gray. When the user clicks a cell in the first column they are able to select a color and that color is then drawn in column 0 and the color’s hex value is shown in column 1.
I believe this line of code is causing the problem as if its taken out the app does not crash:
G.ForeColor = Me.CellTag(Row, 0)
Open Event:
Dim DoIt as Integer
For DoIt = 1 to 24
Me.AddRow ""
Me.CellTag(Me.LastIndex, 0) = &CFFFFFF
Me.Cell(Me.LastIndex, 1) = "FFFFFF"
Me.Cell(Me.LastIndex, 2) = "CC"
Me.Cell(Me.LastIndex, 4) = "-"
Next
Me.ColumnType(1) = 3
Me.ColumnType(3) = 3
Me.ColumnAlignment(1) = 2
Me.ColumnAlignment(2) = 2
CellBackgroundPaint Event:
G.ForeColor = &cF0F0F0
G.FillRect(0, 0, G.Width, G.Height)
If Column = 0 and Me.ListCount <> 0 then
G.ForeColor = Me.CellTag(Row, 0)
G.FillRect (0, 0, 30, G.Height)
Return True
End If
CellClick Event:
Dim C as Color
Dim B as Boolean
Row = Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
Column = Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
Select Case Column
Case 0
If Me.CellTag(Row, 0) = Nil then
C = &cFFFFFF
Else
C = Me.CellTag(Row, 0)
End If
B = SelectColor(C, "Select Color")
If B then
Me.CellTag(Row, 0) = C
Me.Cell(Row, 1) = Replace(Str(C), "&h", "")
End If
Case 2
Dim Clip as New Clipboard
Clip.Text = Me.Cell(Row, 1)
Clip.Close
Case 4
C = &cFFFFFF
Me.CellTag(Row, 0) = C
Me.Cell(Row, 1) = Replace(Str(C), "&h", "")
Me.Cell(Row, 3) = ""
End Select