private void DgvPersonas_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { _id = Convert.ToInt32(DgvPersonas.Rows[e.RowIndex].Cells[0].Value.ToString()); BtnDeseleccionar.Visible = true; Persona personaEditar = new Persona(); personaEditar = _servicio.GetById(_id); CbxTipoContacto.SelectedIndex = CbxTipoContacto.FindStringExact(personaEditar.TipoContacto); TxtNombre.Text = personaEditar.Nombre; TxtApellido.Text = personaEditar.Apellido; TxtTelefono.Text = personaEditar.Telefono; PbFotoPerfil.ImageLocation = personaEditar.FotoPerfil; } }
private void DgvPersons_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { int index = e.RowIndex; _id = Convert.ToInt32(DgvPersons.Rows[index].Cells[0].Value.ToString()); TxtName.Text = DgvPersons.Rows[index].Cells[1].Value.ToString(); TxtLastName.Text = DgvPersons.Rows[index].Cells[2].Value.ToString(); TxtPhone.Text = DgvPersons.Rows[index].Cells[3].Value.ToString(); CbxTipoContacto.SelectedIndex = CbxTipoContacto.FindStringExact(DgvPersons.Rows[index].Cells[4].Value.ToString()); string path = _service.GetPhotoPath(_id); PbFotoPerfil.ImageLocation = path; BtnDeselect.Visible = true; } }