private void ButtonModifyLaser_Click(object sender, EventArgs e) { if (ListViewLasers.SelectedItems.Count != 1) return; AddModify frm = new AddModify(); frm.Text = "Modify Laser..."; frm.static1 = "Name: "; frm.static2 = "Port/Channel: "; frm.text1 = ListViewLasers.SelectedItems[0].SubItems[0].Text; frm.text2 = ListViewLasers.SelectedItems[0].SubItems[1].Text; if (frm.ShowDialog() == DialogResult.OK) { ListViewLasers.SelectedItems[0].SubItems[0].Text = frm.text1; ListViewLasers.SelectedItems[0].SubItems[1].Text = frm.text2; } }
private void ButtonAddLaser_Click(object sender, EventArgs e) { AddModify frm = new AddModify(); frm.Text = "Add Laser..."; frm.static1 = "Name: "; frm.static2 = "Port/Channel: "; if (frm.ShowDialog() == DialogResult.OK) ListViewLasers.Items.Add(new ListViewItem(new string[] { frm.text1, frm.text2 })); }