I'm trying to change several button images according to what state I get in the database. If I get any state "0" I should change the button image to a "busy" image, since the default image is a "free" one.
So my question is: How can i change a button through a variable name?
I have this code for now(i know its wrong):
private void checkSuites()
{
SqlCeCommand checkSuite = new SqlCeCommand("SELECT * FROM RentSessionLog WHERE State='0'", mainConnection);
SqlCeDataReader readSuite = checkSuite.ExecuteReader();
int suiteIndex;
string suitePath = "suite" + suiteIndex;
while (readSuite.Read())
{
suiteIndex = Convert.ToInt32(readSuite["SuiteNum"]);
suitePath.Image = NewSoftware.Properties.Resources.busySuiteImg;
}
}