private void btnQuestion_ButtonClick(object sender, ButtonPressedEventArgs e) { EditorButton btn = e.Button as EditorButton; if (e.Button.Index == 0) { if (grcQuestions.FocusedRowHandle < 0) { return; } string IDQuestion = grcQuestions.GetFocusedRowCellValue(ID).ToString(); frmAddQuestion2 frm = new frmAddQuestion2(IDQuestion); frm.StartPosition = FormStartPosition.CenterParent; frm.ShowDialog(); loadQuestion(); } else { if (XtraMessageBox.Show("Are you sure you want to delete ?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { string IDQuestion = grcQuestions.GetFocusedRowCellValue(ID).ToString(); string res = mdQuestion.Delete(IDQuestion); if (res != "OK") { XtraMessageBox.Show(res); } else { XtraMessageBox.Show("Deleted ID = " + IDQuestion.ToString()); loadQuestion(); } } } }
private void btnAddQuestion_Click(object sender, EventArgs e) { frmAddQuestion2 frm = new frmAddQuestion2(lookUpGroupType.EditValue.ToString(), lookPart.EditValue.ToString()); frm.StartPosition = FormStartPosition.CenterParent; frm.ShowDialog(); //hiển thị form add question loadQuestion(); }