On Feb 23, 2007, at 9:56 am, [EMAIL PROTECTED] wrote:
>>> I have code which runs fine in RB2006r1 but crashes in RB2007r1, and
>>> RB2007r2a2 (beta). I tracked it down to this line :
>>>
>>> listbox1.DeleteAllRows
>>
>> I use listboxes extensively in almost all my projects, and have never
>> seen an application crash simply by calling DeleteAllRows. There must
>> be something else going on. Are you using a subclass of listbox that
>> might be causing the problem? Is there something else in your
>> application that relies on the state of the listbox?
>>
>
> Hi Dennis
> No, I am not doing anything too fancy. And I have not changed this
> part of
> the code in more than a year. However, in 12 attempts, I got the
> debugger
> runtime to crash 12 times at this line, and when I comment it out,
> it doesn't crash.
> And as I mentioned, its something new about the compiler from
> 2006R1 to
> 2007R1. I am thinking it might have something to do with the paint-
> like events
> dealing with an empty box.
>
Greg,
If you're doing any painting, you need to check to see if the
row<=lastindex before accessing listbox.cell(row,column). They
changed this so that you can do things like alternating colored lines:
Function CellBackgroundPaint(g As Graphics, row As Integer, column As
Integer) As Boolean
if row mod 2 = 0 then
g.ForeColor = &cEEEEFF
g.FillRect 0,0,g.Width,g.Height
end if
'if me.cell(row,column) = "help" then '<------- Error Here
-------------
'g.ForeColor = &cFFEEEE
'g.FillRect 0,0,g.Width,g.Height
'end if
End Function
If you uncomment the second group, it will fail with an
OutOfBoundsException on the indicated line.
GregO
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>