private void edit_Click(object sender, EventArgs e) { Module minfo = new Module(); if (this.moduleList.SelectedRows.Count > 0) { if (this.moduleList.SelectedRows.Count == 1) { var row = this.moduleList.SelectedRows[0].Cells; // info. = ; minfo.Id = Int32.Parse(row[0].Value.ToString()); minfo.Module_type = row[1].Value.ToString(); minfo.Module_text = row[2].Value.ToString(); var childForm = new ModuleDefine(minfo); var result = childForm.ShowDialog(); if (result == DialogResult.OK) { ModuleManager_Load(sender, e); } } else { MessageBox.Show("请选择一条数据进行编辑!"); return; } } else { MessageBox.Show("请选择要编辑的数据!"); return; } }
private void add_Click(object sender, EventArgs e) { var childForm = new ModuleDefine(); var result = childForm.ShowDialog(); if (result == DialogResult.OK) { ModuleManager_Load(sender, e); } }