Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var workers = new WorkersForm()
            {
                Workers = new Workers()
            };

            if (workers.ShowDialog(this) == DialogResult.OK)
            {
                listBox2.Items.Add(workers.Workers);
            }
        }
Exemple #2
0
        private void listBox2_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.listBox2.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                var worker = (Workers)listBox2.Items[index];
                var ff     = new WorkersForm()
                {
                    Workers = worker
                };
                if (ff.ShowDialog(this) == DialogResult.OK)
                {
                    listBox2.Items.Remove(worker);
                    listBox2.Items.Insert(index, worker);
                }
            }
        }