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

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -