Exemplo n.º 1
0
        private void add_Click(object sender, EventArgs e)
        {
            EmployeesAddList emp = new EmployeesAddList(textBox1.Text, textBox2.Text, Convert.ToInt32(Salary.Value), Convert.ToInt32(Children.Value), Convert.ToInt32(xp.Value));

            Add(emp);
            Clear();
        }
Exemplo n.º 2
0
        private void Add(EmployeesAddList emp)
        {
            ListViewItem lvi = new ListViewItem(emp.name);

            lvi.Tag = emp;
            listE.Items.Add(lvi);
        }
Exemplo n.º 3
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listE.SelectedItems.Count == 1)
     {
         EmployeesAddList emp = (EmployeesAddList)listE.SelectedItems[0].Tag;
         if (emp != null)
         {
             textBox1.Text  = emp.name;
             textBox2.Text  = emp.position;
             Salary.Value   = emp.salary;
             Children.Value = emp.children;
             xp.Value       = emp.xp;
         }
     }
     else if (listE.SelectedItems.Count == 0)
     {
         Clear();
     }
 }