private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { object Data = dgvData.Rows[e.RowIndex].DataBoundItem; if (Data != null && Data is Aula) { Aula obj = (Aula)Data; if (obj != null) { switch (dgvData.Columns[e.ColumnIndex].Name) { case "clmPresenca": FormOpen(new FrmAulaPresAval(obj, dgvData.Rows[e.RowIndex].Cells[1].FormattedValue?.ToString())); break; case "clmEdit": FormOpen(new FrmAulaEdicao(obj)); break; case "clmDelete": if (Msg.Question("Deseja realmente excluir o registro??", "Excluir Registro")) { obj.Delete(); } break; } } } } }