private void tsbNewInput_Click(object sender, EventArgs e) { try { string controlType = (sender as ToolStripButton).Text; InputItem iiNew = new InputItem(); iiNew.ControlType = FuncConstDefine.Txt; frmFuncInput ffi = new frmFuncInput(); ffi.OnCheckNameExists -= CheckNameExists; ffi.OnCheckNameExists += CheckNameExists; iiNew = ffi.ShowInput(this, iiNew); if (iiNew == null) { return; } funcControl1.Inputs.Add(iiNew.Name, iiNew); BindInputData(); LocateRow(iiNew.Name); funcControl1.AddInputControl(iiNew, iiNew.Name); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void tsbModify_Click(object sender, EventArgs e) { try { if (dataGridView1.SelectedRows.Count <= 0) { MessageBox.Show("请选择需要修改的项目。"); return; } string name = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString(); InputItem iiUpdate = funcControl1.Inputs[name]; if (iiUpdate == null) { MessageBox.Show("未找到对应项目配置信息。"); return; } frmFuncInput ffi = new frmFuncInput(); //ffi.OnCheckNameExists -= CheckNameExists; //ffi.OnCheckNameExists += CheckNameExists; iiUpdate = ffi.ShowInput(this, iiUpdate); if (iiUpdate == null) { return; } //更新明细信息 LoadInputDetail(iiUpdate.Name); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }