Create a collection of Button references and then reference the buttons via the collection.
List<Button> buttons = new List<Button>(NUMBER_OF_BUTTONS); buttons[0] = button0; buttons[1] = button1; ... buttons[i].Text = "Hello" ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Anthony Mayan Sent: Tuesday, 26 July 2011 11:17 AM To: ozDotNet Subject: Set property of texbox by name I have a form with many buttons. I want to be able to set the text property of the textbox at runtime by string. ("Button" & i).Text = "Hello" 'Of course this doesn't work...how do i replicate this correctly i a variable eg if i=1 then i want the code to do button1.text="Hello" if i=2 then i want the code to do button2.text="Hello" any suggest This email is intended for the named recipient only. The information it contains may be confidential or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it. If you have received this email in error, please contact the sender immediately and delete the message from your computer.
