c# - Update display label when changed numericupdown value and button click -
i have nested loop project have display triangle asterisks getting value numericupdown control , displaybutton click. well, work, displays correct shape , number of stars.
but when try change value numericupdown control, display label not update, instead, add underneath previous result. need display label update/change when value changed numericupdown, , when displaybutton clicked.
private void displaybutton_click(object sender, eventargs e) { if (radiobutton1.checked == true) { int counter = (int)sidelengthnumericupdown.value; (int r = 0; r < counter; r++) { (int c = 0; c <= r; c++) { displaylabel.text += counter.tostring("*"); } displaylabel.text += counter.tostring("\n"); } } else if (radiobutton2.checked == true) { int counter = (int)sidelengthnumericupdown.value; (int r = counter; r > 0; r--) { (int c = 0; c < r; c++) { displaylabel.text += counter.tostring("*"); } displaylabel.text += counter.tostring("\n"); } }
Comments
Post a Comment