private void gvCategory_DoubleClick(object sender, EventArgs e) { UserCategory cate = bsCategory.Current as UserCategory; if (cate == null) { return; } using (FrmAddCategory frm = new FrmAddCategory(cate.CategoryCode, 1, cate.CategoryName)) { if (frm.ShowDialog() == DialogResult.OK) { this.bsCategory.DataSource = AGVDAccess.AGVClientDAccess.get_Category(); bsCategory.ResetBindings(false); bsCategory.MoveLast(); gvCategory_FoucsedRowChanged(null, null); } } }
private void newCategory_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { gvCategory.BeforeLeaveRow -= gvCategory_BeforeLeaveRow; using (FrmAddCategory frm = new FrmAddCategory(bsCategory.Count + 1.ToString(), 0, "")) { if (frm.ShowDialog() == DialogResult.OK) { this.bsCategory.DataSource = AGVDAccess.AGVClientDAccess.get_Category(); bsCategory.ResetBindings(false); bsCategory.MoveLast(); gvCategory_FoucsedRowChanged(null, null); } } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } finally { gvCategory.BeforeLeaveRow += gvCategory_BeforeLeaveRow; } }