// Get information about employee to edit private void EditButton_Click(object sender, EventArgs e) { ListViewItem item = lstEmployeesListView.Items[lstEmployeesListView.SelectedIndices[0]]; clsEmployee editEmployee = new clsEmployee(); editEmployee.ID = (Convert.ToInt32(item.SubItems[0].Text)); editEmployee.Read(); using (frmEmployeesInformation InfoForm = new frmEmployeesInformation(false) { newEmployee = editEmployee }) { InfoForm.txtNameBox.Text = editEmployee.Name; InfoForm.txtNationalIDBox.Text = editEmployee.NationalID.ToString(); InfoForm.txtHeightBox.Text = editEmployee.Height.ToString(); InfoForm.txtWeightBox.Text = editEmployee.Weight.ToString(); InfoForm.BirthDatePicker.Value = editEmployee.Birthdate.Date; if (InfoForm.ShowDialog() == DialogResult.OK) { if (InfoForm.validValue) { editEmployee.Name = InfoForm.txtNameBox.Text; editEmployee.NationalID = Convert.ToInt32(InfoForm.txtNationalIDBox.Text); editEmployee.Height = Convert.ToDouble(InfoForm.txtHeightBox.Text); editEmployee.Weight = Convert.ToDouble(InfoForm.txtWeightBox.Text); editEmployee.Birthdate = InfoForm.BirthDatePicker.Value.Date; editEmployee.Update(); lstEmployeesListView.SelectedItems[0].SubItems[1].Text = editEmployee.Name; lstEmployeesListView.SelectedItems[0].SubItems[2].Text = editEmployee.Birthdate.ToShortDateString(); } } } }