private void getDadosRow() { foreach (DataGridViewColumn column in gridDados.Columns) { if (column.DataPropertyName == "Código") { int id = Int32.Parse((gridDados.CurrentRow.Cells[column.DisplayIndex].Value).ToString()); classe = dao.getClasseComProfessores(id); textBoxNome.Text = classe.Nome; gridProfessores.Rows.Clear(); foreach (PessoaEntity professor in classe.Professores.Values) { gridProfessores.Rows.Add(new Object[] { professor.Id, professor.Nome, professor.DataNascimento.ToString("dd/MM/yyyy") }); } gridProfessores.Refresh(); } } }