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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -