private void btnUpdate_Click(object sender, EventArgs e) { try { if (fDataCheck() == true) { Control.配布員 Staff = new Control.配布員(); switch (fMode.Mode) { case 0: //新規登録 if (MessageBox.Show("新規登録します。よろしいですか?", "登録確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { Staff.Close(); return; } if (Staff.DataInsert(cMaster) == true) { MessageBox.Show("新規登録されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("新規登録に失敗しました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Stop); } break; case 1: //更新 if (MessageBox.Show("更新します。よろしいですか?", "更新確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { Staff.Close(); return; } if (Staff.DataUpdate(cMaster) == true) { MessageBox.Show("更新されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("更新に失敗しました", "所属マスター", MessageBoxButtons.OK, MessageBoxIcon.Stop); } break; } Staff.Close(); DispClear(); //データを 'darwinDataSet.配布員' テーブルに読み込みます。 this.配布員TableAdapter.Fill(this.darwinDataSet.配布員); //this.配布員gridviewTableAdapter.Fill(this.darwinDataSet.配布員gridview); // グリッド再表示 gridSerach(dataGridView1); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "更新処理", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }