private void listViewAdminD_SelectedIndexChanged(object sender, EventArgs e) { ListView.SelectedListViewItemCollection selectedDoctor = this.listViewAdminD.SelectedItems; foreach (ListViewItem item in selectedDoctor) { int id = Convert.ToInt32(item.SubItems[0].Text); string name = item.SubItems[1].Text; Doctor doctor = _doctorRepository.GetDoctorByID(id); if (doctor != null) { buttonGenerateID.Enabled = false; button1.Enabled = false; buttonAdminDAdd.Enabled = false; buttonAdminDRemove.Enabled = true; textBoxAdminDName.Text = doctor.Name; textBoxAdminDID.Text = doctor.ID.ToString(); textBoxAdminDAddress.Text = doctor.Address; textBoxAdminDUsername.Text = doctor.Username; textBoxAdminDPassword.Text = doctor.Password.ToString(); } } }