[Mono-list] ListBox RemoveAt error.

Ivan N. Zlatev contact at i-nz.net
Mon Jan 12 10:54:34 EST 2009


On Mon, Jan 12, 2009 at 3:29 PM, Steve Harp <steve at abelscreening.com> wrote:

>  Hi All,
>
>
>
> I'm using a ListBox in a WinForms application under Linux to provide
> status/progress messages to the user.  I'd like to limit the # of items in
> the ListBox by deleting the first entry after some pre-defined limit has
> been reached.
>
>
>
> If (ListBox1.Items.Count > myLimit)
> {
>
>   ListBox1.Items.RemoveAt(0);
>
> }
>
>
>
> Whenever the application hits the RemoveAt line, it throws an exception.
>
>
>
> System.ArgumentOutOfRangeException: Argument is out of range.
>
> Parameter name: GetItemRectangle index out of range.
>
>   at System.Windows.Forms.ListBox.GetItemRectangle (Int32 index) [0x00167]
> in
> /usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:847
>
>
>   at System.Windows.Forms.ListBox.GetItemDisplayRectangle (Int32 index,
> Int32 first_displayble) [0x00008] in
> /usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:1286
>
>
>   at System.Windows.Forms.ListBox.InvalidateItem (Int32 index) [0x0000c] in
> /usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:1687
>
>
>   at (wrapper remoting-invoke-with-check)
> System.Windows.Forms.ListBox:InvalidateItem (int)
>
>   at System.Windows.Forms.ListBox+SelectedIndexCollection.ClearCore ()
> [0x00030] in
> /usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:2699
>
>
>   at System.Windows.Forms.ListBox+SelectedIndexCollection.Clear ()
> [0x00000] in
> /usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:2687
>
>
>   at System.Windows.Forms.ListBox.ClearSelected () [0x00000] in
> /usr/src/packages/BUILD/mono-2.0.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs:716
>
>
>   at (wrapper remoting-invoke-with-check)
> System.Windows.Forms.ListBox:ClearSelected ()
>
>
>
> I have similar code running on Windows boxes and it works fine with MS
> .NET.  What is the correct way to do this with Mono?
>
>
>
> Thanks,
>
> Steve
>
This most definitely seems like a bug in Mono, so please file a bug  with  a
small test case to reproduce the issue - http://mono-project.com/Bugs



-- 
Kind Regards,
Ivan N. Zlatev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090112/44620164/attachment.html 


More information about the Mono-list mailing list