private void dgvApplication_SelectionChanged(object sender, EventArgs e) { if (dgvApplication.SelectedCells.Count <= 0 || dgvApplication.SelectedCells[0].RowIndex < 0) return; var rowIndex = dgvApplication.SelectedCells[0].RowIndex; var row = dgvApplication.Rows[rowIndex]; var applicationId = Int32.Parse(row.Cells["ID"].Value.ToString()); _selectedApplication = _applicationService.GetApplicationById(applicationId); var name = row.Cells["Name"].Value.ToString(); var applicationGroup = _applicationService.GetApplicationGroupByApplicationName(name); txtApplicationName.Text = name; cbApplicationGroup.Text = (applicationGroup != null) ? applicationGroup.Name : ""; }
private void ResetForm() { txtApplicationName.Text = ""; cbApplicationGroup.SelectedIndex = -1; _selectedApplication = null; dgvApplication.ClearSelection(); dgvApplication.CurrentCell = null; dgvApplicationGroup.ClearSelection(); dgvApplicationGroup.CurrentCell = null; }