private void listView1_DoubleClick(object sender, EventArgs e) { device dev4view = (device)listView1.SelectedItems[0].Tag; using (view_device vw = new view_device(dev4view)) { DialogResult dr = vw.ShowDialog(); if (dr == DialogResult.Yes) { dev4view = vw.viewDev; } } }
public view_device(device dev) { InitializeComponent(); //initui(); if (dev != null) { this.viewDev = dev; } else { this.DialogResult = DialogResult.Cancel; this.Close(); } }
private void toolStripButton1_Click(object sender, EventArgs e) { //Console.WriteLine(this.Width-(groupBox1.Location.X+groupBox1.Width)); using (NewDevice nwd = new NewDevice()) { DialogResult dr = nwd.ShowDialog(); if (dr == DialogResult.OK) { device tempdev = new device(); tempdev.Company = nwd.company; tempdev.Serial = nwd.serial; tempdev.Technician = nwd.tech; tempdev.InsDate = nwd.insdate; ListViewItem lvi = new ListViewItem(); lvi.Text = tempdev.Serial; lvi.Tag = tempdev; //Console.WriteLine(tempdev.Serial); listView1.Items.Add(lvi); } } }