c# - having a check box in message box -
this question has answer here:
- how show messagebox checkbox? 3 answers
in message box there 2 buttons, yes
, no
. want have checkbox inside of message box says do items
, if button yes
selected , true items , if no
selected , true items.
is possible in messagebox?
the answer question no. cannot create messagebox checkbox. have create custom dialog box. need create form looks way wish , use showdialog() method display form. display modal dialog box in application. code after showdialog method not executed until dialog box closed.
using (form2 frm = new form2()) { frm.showdialog(); if (frm.dialogresult == dialogresult.yes) { } else if (frm.dialogresult == dialogresult.no) { } }
on clicking yes or no within dialog box, following close dialog box dialogresult
private void btnyes_click(object sender, eventargs e) { dialogresult = dialogresult.yes; } private void btnno_click(object sender, eventargs e) { dialogresult = dialogresult.no; }
Comments
Post a Comment