private void ButtonModifyCounter_Click(object sender, EventArgs e) { if (ListViewCounters.SelectedItems.Count != 1) return; AddModify2 frm = new AddModify2(); frm.Text = "Add CounterBoard..."; frm.static1 = "Name: "; frm.static2 = "Port/Channel: "; frm.static3 = "Timebase: "; frm.static4 = "Trigger: "; frm.text1 = ListViewCounters.SelectedItems[0].SubItems[0].Text; frm.text2 = ListViewCounters.SelectedItems[0].SubItems[1].Text; frm.text3 = ListViewCounters.SelectedItems[0].SubItems[2].Text; frm.text4 = ListViewCounters.SelectedItems[0].SubItems[3].Text; if (frm.ShowDialog() == DialogResult.OK) { ListViewCounters.SelectedItems[0].SubItems[0].Text = frm.text1; ListViewCounters.SelectedItems[0].SubItems[1].Text = frm.text2; ListViewCounters.SelectedItems[0].SubItems[2].Text = frm.text3; ListViewCounters.SelectedItems[0].SubItems[3].Text = frm.text4; } }
private void ButtonAddCounter_Click(object sender, EventArgs e) { AddModify2 frm = new AddModify2(); frm.Text = "Add CounterBoard..."; frm.static1 = "Name: "; frm.static2 = "Port/Channel: "; frm.static3 = "Timebase: "; frm.static4 = "Trigger: "; if (frm.ShowDialog() != DialogResult.OK) return; ListViewLasers.Items.Add(new ListViewItem(new string[] { frm.text1, frm.text2, frm.text3, frm.text4 })); }