c# - link two check boxes to one messagebox? -
in form when check both checkboxes messagebox displayed. both checkboxes linked 1 messagebox. have tried different messagebox functionality end displaying messagebox when 1 check box marked.
if (e.keycode == keys.q) checkbox1.checked = !checkbox1.checked; if (e.keycode == keys.a) checkbox2.checked = !checkbox2.checked; messagebox.show("task completed", "form1");
this worked me.
private void cbox2_checked(object sender, routedeventargs e) { if (cbox1.ischecked == true && cbox2.ischecked == true) { messagebox.show("task completed", "form1"); } } private void cbox1_checked(object sender, routedeventargs e) { if (cbox1.ischecked == true && cbox2.ischecked == true) { messagebox.show("task completed", "form1"); } }
set if
statements @ both checked
events of check boxes
not elegant, working.
Comments
Post a Comment