private void 修改车型ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (this.gridView1.RowCount == 0 || this.gridView1.GetSelectedRows()[0] < 0) { MessageBox.Show("请选中要修改的行"); return; } strOperationFlag = "modify"; Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("车型编号", this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, this.gridView1.Columns[0]).ToString()); dic.Add("车型名称", this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, this.gridView1.Columns[1]).ToString()); FormLatheInfoEdit frm = new FormLatheInfoEdit(strOperationFlag, dic); frm.Owner = this; frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { FreshForm(); } } catch (System.Exception ex) { MessageBox.Show("修改车型信息时发生错误!" + ex.Message, "提示信息"); return; } }
private void 添加车型ToolStripMenuItem_Click(object sender, EventArgs e) { try { strOperationFlag = "add"; FormLatheInfoEdit frm = new FormLatheInfoEdit(strOperationFlag, null); frm.Owner = this; frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { FreshForm(); } } catch (System.Exception ex) { MessageBox.Show("添加车型信息时发生错误!" + ex.Message, "提示信息"); return; } }