I have a bunch of labels on a form that needs updating its Text property from variables. I don’t want to repetitively write out each control .Text and assign the values and variables.
This is the code that is easiest to write, but harder to maintain, and takes up so much space:
LabelA1.Text = "Text :" + varSomething;
LabelA2.Text = "Text :" + varSomething;
LabelA3.Text = "Text :" + varSomething;
LabelB1.Text = "Text :" + varSomethingElse;
LabelB2.Text = "Text :" + varSomethingElse;
LabelB3.Text = "Text :" + varSomethingElse;
Is there a way to write it more concisely and be easier to maintain and extend?