private void button2_Click(object sender, EventArgs e) { var d = new DescriptionForm() { ProblemDescription = new ProblemDescription() }; if (d.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Add(d.ProblemDescription); } }
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = listBox1.IndexFromPoint(e.Location); if (index != ListBox.NoMatches) { var item = (ProblemDescription)listBox1.Items[index]; var df = new DescriptionForm() { ProblemDescription = item }; if (df.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Remove(item); listBox1.Items.Insert(index, item); } } }