private void _mainView_DataCellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { pressedCell = _mainView.Data.Rows[e.RowIndex].Cells[e.ColumnIndex]; if (pressedCell.Value == null) { _editView.Display(pressedCell); } else { Class item = _manager.GetItem(e.ColumnIndex, e.RowIndex); _editView.Display(pressedCell, item.Subject, item.FromTime, item.ToTime, item.Teacher); } } } catch (Exception ex) { _messageService.ShowError(ex.ToString()); } }