private void button1_Click(object sender, EventArgs e) { var items = new ItemsForm() { Items = new Items() }; if (items.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Add(items.Items); } }
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { var item = (Items)listBox1.Items[index]; var ff = new ItemsForm() { Items = item }; if (ff.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Remove(item); listBox1.Items.Insert(index, item); } } }