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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -