Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var items = new AddWorker()
            {
                Workers = new Workers()
            };

            if (items.ShowDialog(this) == DialogResult.OK)
            {
                listBox1.Items.Add(items.Workers);
            }
        }
Exemplo n.º 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 worker = (Workers)listBox1.Items[index];
                var ff     = new AddWorker()
                {
                    Workers = worker
                };
                if (ff.ShowDialog(this) == DialogResult.OK)
                {
                    listBox1.Items.Remove(worker);
                    listBox1.Items.Insert(index, worker);
                }
            }
        }