private void ShowButton_Click(object sender, EventArgs e) { if (this.listBox.SelectedItem != null) { using (ShowExperimentForm form = new ShowExperimentForm(this.experimentsList[this.listBox.SelectedIndex])) { form.Show(); } } }
private void ListBox_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { using (ShowExperimentForm form = new ShowExperimentForm(experimentsList[listBox.SelectedIndex])) { form.Show(); } } }