Double Click Closing a Listbox

  • Thread starter Thread starter Blacky
  • Start date Start date
B

Blacky

Hi

I have a small form with a listbox. When double clicking on an item, the
item is added to another form and then the form is closed. But this creates
an exception error saying that the ListBox does not excist.

How do I fix this?
Thank You

Code:
(the other form)
create dialog

frmSuppliers frmSupp = new frmSuppliers();
base.Enable = false;
frmSupp.Closing += ....(frm_closing);
frmSupp.Show();

....frm_closing( [arguments])
{
txtSupplier.Text = frmSupp.GetSupplier();
base.Enable = true;
}

(the form with listbox)
.....DoubleClick( ....)
{
txtSuppName = lst.ItemSelected.ToString();
this.Close();
}
 
Hi,

With the code you gave nothing clear comes out, nevertheless I think that
you can solve your problem like this:

In the ListBox's form on the doubleclick event save the value on a variable,
make it available to the calling form by either making it public or with a
property
in this way the caller form will have access to the selected value.

If this does not solve your problem post more code and a detailed
description of how the forms are related.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top