private void button1_Click(object sender, EventArgs e) { var add = new Suggestion_for_improvement() { Suggestion = new Suggestion_for_improvements() }; if (add.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Add(add.Suggestion); } }
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); if (index != ListBox.NoMatches) { var item = (Suggestion_for_improvements)listBox1.Items[index]; var add = new Suggestion_for_improvement() { Suggestion = item }; if (add.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Remove(item); listBox1.Items.Insert(index, item); } } }