private void buttonX_Add_Click(object sender, EventArgs e) { LawFileInfoAddAndEditForm lawFileInfoAddAndEditForm = new LawFileInfoAddAndEditForm("Add", null); if (lawFileInfoAddAndEditForm.ShowDialog() == DialogResult.OK) { RefreshFileInfo(); } }
private void buttonX_Edit_Click(object sender, EventArgs e) { if (dataGridView_LawFileInfo.SelectedRows.Count <= 0) { MessageBox.Show("请先选中一行数据"); return; } var row = dataGridView_LawFileInfo.SelectedRows[0]; long ID = (long)(row.Cells[0].Value); var LawFileInfo = lawFileInfoList.Find(_ => _.ID == ID); if (LawFileInfo == null) { MessageBox.Show("数据错误"); return; } LawFileInfoAddAndEditForm lawFileInfoAddAndEditForm = new LawFileInfoAddAndEditForm("Edit", LawFileInfo); if (lawFileInfoAddAndEditForm.ShowDialog() == DialogResult.OK) { RefreshFileInfo(); } }