private void TabList_DoubleClick(object sender, EventArgs e) { if (TabList.SelectedItem == null) { return; } if (TabList.IndexFromPoint(TabList.PointToClient(MousePosition)) == ListBox.NoMatches) { return; } DialogResult = DialogResult.OK; Close(); }