Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ad = new AddGun(new Specifications {
                ProductionDate = DateTime.Now
            });

            if (ad.ShowDialog(this) == DialogResult.OK)
            {
                listBox1.Items.Add(ad.Specifications);
            }
        }
Example #2
0
        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.listBox1.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                var item = (Specifications)listBox1.Items[index];
                var ad   = new AddGun(item);
                if (ad.ShowDialog(this) == DialogResult.OK)
                {
                    listBox1.Items.Remove(item);
                    listBox1.Items.Insert(index, item);
                }
            }
        }