void btnPopertyAdd_Click(object sender, EventArgs e) { var obj = new ConfigData.Poperty(); var poperties = dataGridViewPoperty.DataSource as List <ConfigData.Poperty> ?? new List <ConfigData.Poperty>(); new FrmAddOrEdit(obj, () => { poperties.Add(obj); }).ShowDialog(); dataGridViewPoperty.DataSource = poperties.ToList(); }
void btnPopertyUpate_Click(object sender, EventArgs e) { var poperties = dataGridViewPoperty.DataSource as List <ConfigData.Poperty> ?? new List <ConfigData.Poperty>(); if (dataGridViewPoperty.CurrentRow != null && dataGridViewPoperty.CurrentRow.Index >= 0) { var obj = dataGridViewPoperty.CurrentRow.DataBoundItem as ConfigData.Poperty; var newObj = new ConfigData.Poperty(); newObj.DisplayName = obj.DisplayName; //newObj.Name = obj.Name; new FrmAddOrEdit(newObj, () => { obj.DisplayName = newObj.DisplayName; //obj.Name = newObj.Name; }).ShowDialog(); } dataGridViewPoperty.Refresh(); }