Can I run multiple control but same method in C# -
for example
txtunittotalqty.text = ""; txtprice.text = ""; txtunitprice.text = ""; lbltotalvalue.text = "";
to like
(txtunittotalqty, txtprice, txtunitprice, lbltotalvalue).text = "";
you can this:
txtunittotalqty.text = txtprice.text = txtunitprice.text = lbltotalvalue.text = string.empty;
or write method it:
public void settext(params textbox[] controls, string text) { foreach(var ctrl in controls) { ctrl.text = text; } }
usage of be:
settext(txtunittotalqty, txtprice, txtunitprice, lbltotalvalue, string.empty);
Comments
Post a Comment