I am using .VS.NET 2003.
code is pretty simple.
1. Created new c# project and it loaded default form "Form1"
2. I added listbox with default name listBox1
3.Added double click event
4. Added one line of code in that event
this.Close()
When i double clicked on listbox everything works fine. Form closed properly
without any errors.
--
Shak
(Houston)
"JoeHenrich" <Jo********@discussions.microsoft.com> wrote in message
news:C3**********************************@microsof t.com...
Can you provide me the code for what your tried? And, what version of
..NET you are running? Thanks
"Shakir Hussain" wrote:
Joe,
I tried a sample like you described. Form closes properly after
doubleclick in listbox. No issues at all.
--
Shak
(Houston)
"JoeHenrich" <Jo********@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com... I am using VS.NET 2003 and am having an interesting issue with a
Listbox control. Essentially, I have a form with a listbox on it. In the
listbox doubleclick event I would like to do some processing and then close the
form. However, I receive an error (Cannot access a disposed object
named "ListBox".) after my doubleclick code has processed.
/* ***************************
private void listBox1_DoubleClick(object sender, System.EventArgs e)
{
this.Close();
}
****************************/
To reproduce, create a form, drop a listbox on it, assign the
doubleclick event and put "this.Close();" in the handler. Does anyone know if there
is a fix to this issue? There are workarounds, best I've seen so far is: /****************************
private void listBox1_DoubleClick(object sender, System.EventArgs e)
{
this.BeginInvoke( new EventHandler( CloseForm ) );
}
private void CloseForm( Object sender, EventArgs e )
{
this.Close();
}
***********************************/
I think this must be an error in how the message processing is handled
within the list box control itself?
Thanks,
Joe