Need to change properties of control with same name as string variable
Posted on 2006-05-14
1) I return a single string variable from a database. This string is the same as one of hundreds of winform controls on the page:
examples: "Button19", "Button78", "Button32", "TextBox95", "Label2", etc
2) I want to alter a property for the control that has the same name. For example, if the returned string is "Button78", then I'd like to alter a property for the System.Windows.Forms.Button control named Button78.
example: Button78.BackColor = Color.Blue
Can anyone please provide a routine to accomplish this? I'm having trouble referencing or pointing to the desired control.
I have built a graphical representation of all the servers, switches, etc. in our server room. Each port was drawn as a small button. When I click any port button, I want the mating port (I get this button's name from the SQL database) to change color. I'm also using GDI+ to draw a line representing the connecting Cat5e wire between the two ports.