RE: ListBox, Double-Click and Closing Form
From: Bonnie Berent [C# MVP] (BonnieBerentCMVP_at_discussions.microsoft.com)
Date: 02/25/05
- Next message: Patrice Ongla: "Re: master-detail relation with object binding"
- Previous message: Roger Stenson: "Re: Parameters for the Load Routine of a Form"
- In reply to: Bonnie Berent [C# MVP]: "ListBox, Double-Click and Closing Form"
- Next in thread: Robbe Morris [C# MVP]: "Re: ListBox, Double-Click and Closing Form"
- Reply: Robbe Morris [C# MVP]: "Re: ListBox, Double-Click and Closing Form"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Feb 2005 08:33:02 -0800
OK, well, I just found out that the guy who originally had this problem (I
posted this here in order to try and help the guy), is using this form as a
modal dialog (which, if I had thought about it a little more, I would have
realized from the get-go), so I told him that he doesn't need to close it.
Just perform the click of his accept button.
Still, I wonder if there is any other way around this (in case there is a
legitimate need for this kind of functionality)?
~~Bonnie
"Bonnie Berent [C# MVP]" wrote:
> OK, here's a mystery for you guys. It's a bug, I'm sure, but my question is:
> is there a workaround?
>
> Set up a Double-click event handler for a ListBox. In that event handler,
> either close the form (this.Close()) or call another method that closes it,
> doesn't matter.
>
> You get an error:
>
> An unhandled exception of type 'System.ObjectDisposedException' occurred in
> system.windows.forms.dll
>
> Additional information: Cannot access a disposed object named "ListBox".
>
> This only seems to happen for ListBoxes. I tried it with a ListView and a
> DataGrid and everything worked fine.
>
> Any workarounds?
>
> TIA,
> ~~Bonnie
- Next message: Patrice Ongla: "Re: master-detail relation with object binding"
- Previous message: Roger Stenson: "Re: Parameters for the Load Routine of a Form"
- In reply to: Bonnie Berent [C# MVP]: "ListBox, Double-Click and Closing Form"
- Next in thread: Robbe Morris [C# MVP]: "Re: ListBox, Double-Click and Closing Form"
- Reply: Robbe Morris [C# MVP]: "Re: ListBox, Double-Click and Closing Form"
- Messages sorted by: [ date ] [ thread ]