In the handling method, use the following code:
private void listBox1_DoubleClick(object sender, EventArgs e)
{
if (listBox1.SelectedItem != null)
{
listBox1.FindForm().DialogResult = DialogResult.OK;
}
}
ListBox listBox = sender as ListBox ;
if (listBox.SelectedItem != null)
{
listBox.FindForm().DialogResult = DialogResult.OK;
}
No comments:
Post a Comment