private void btnEdit_Click(object sender, EventArgs e) { try { if (dgvBrand.Rows.Count > 0) { l_rowindex = dgvBrand.CurrentRow.Index; if (dgvBrand.CurrentRow.Cells[0].Value != null) { //Convert.ToString(dgvBrand.CurrentRow.Cells[0].Value); //pan.BackColor = Color.AliceBlue; // SetBrand L_SetAgent = new SetBrand((long)dgvBrand.CurrentRow.Cells[dgvtxaskey.Index].Value); SetBrand L_SetBrand = new SetBrand(Convert.ToString(dgvBrand.CurrentRow.Cells[0].Value)); L_SetBrand.ShowDialog(); if (L_SetBrand.DialogResult == DialogResult.Cancel) { loadGrid(); } dgvBrand.Rows[l_rowindex].Selected = true; //dgvBrand.CurrentCell = dgvBrand.Rows[l_rowindex].Cells[0]; //dgvBrand.CurrentRow. = l_rowindex; //pan.BackColor = System.Drawing.SystemColors.Control; // this.textBox1.BackColor = System.Drawing.SystemColors.Control; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); //GeneralUtility.ShowErrorMsg(ex); } }
private void btnAddNew_Click(object sender, EventArgs e) { try { SetBrand L_SetBrand = new SetBrand(); L_SetBrand.ShowDialog(); if (L_SetBrand.DialogResult == DialogResult.Cancel) { loadGrid(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }