private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); if (index != ListBox.NoMatches) { var item = (Competitor)listBox1.Items[index]; var ff = new ReadOnlyForm() { Competitor = item }; if (ff.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Remove(item); listBox1.Items.Insert(index, item); } } }
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); Jewelry item = new Jewelry(); if (index != ListBox.NoMatches) { foreach (Jewelry tmp in Jew) { if (tmp.JewType == listBox1.Items[index]) { item = tmp; } } var ff = new ReadOnlyForm() { Jewelry = item }; ff.ShowDialog(this); } }