private bool updateDoc() { dcore = new DataCoreLibrary(); string cbbcode; cbbcode = DataControls.GetSelectedValueComboBoxToString(cbb); if (cbbcode != "" && cbbcode != null) { switch (mode) { case "addictive": { dcore.UpdateAddictive(navyid, cbbcode); } break; default: { if (gvSearch.SelectedRows[0].Cells["คพท"].Value.ToString() != "") { DialogResult dialogResult = MessageBox.Show( "พลฯ " + gvSearch.SelectedRows[0].Cells["ชื่อ"].Value.ToString() + " " + gvSearch.SelectedRows[0].Cells["นามสกุล"].Value.ToString() + " มีสาขาอาชีพ" + gvSearch.SelectedRows[0].Cells["คพท"].Value.ToString() + " ยืนยันการเปลี่ยนสาขาอาชีพหรือไม่?", "แจ้งเตือน", MessageBoxButtons.YesNo); /*if (dialogResult == DialogResult.Yes) * { * updateDoc(); * }*/ if (dialogResult == DialogResult.No) { return(false); } } dcore.UpdateKptclass(navyid, cbbcode); } break; } MessageBox.Show("เสร็จสิีน"); load(); txtname.Text = ""; txtsname.Text = ""; mtxtid8.Text = ""; txtname.Focus(); return(true); } else { MessageBox.Show("เลือกสาขาอาชีพก่อน"); cbb.Focus(); return(false); } }