//On dateView click private void dataView_onCellClick(object sender, DataGridViewCellEventArgs e) { this.resultController = mainController.resultController; int id = 0; try { //Gets the ID from the selected row id = (int)dataView.Rows[e.RowIndex].Cells[3].Value; } //When user clicks on the DataGrid header (ID,GEBRUIKER, ETC.) // catch (ArgumentOutOfRangeException) { } resultController.OpenResultDialog(e, id); }