I have a WinForms program which pulls data from a .csv file and lists it in a table with one entry being listed in a textbox to allow changes. I add the textbox through the following code which works correctly.
for (int i = 0; i < listLength; i++)
{
Label itemCodeData = new Label();
itemCodeData.Text = itemCode[i];
dynamicTableLayoutPanel.Controls.Add(itemCodeData, 0, i+1);
Label itemDescData = new Label();
itemDescData.Text = itemDescription[i];
dynamicTableLayoutPanel.Controls.Add(itemDescData, 1, i + 1);
TextBox currentCountData = new TextBox();
currentCountData.Text = currentCount[i];
dynamicTableLayoutPanel.Controls.Add(currentCountData, 2, i + 1);
Label onOrderData = new Label();
onOrderData.Text = onOrder[i];
dynamicTableLayoutPanel.Controls.Add(onOrderData, 3, i + 1);
}
What im trying to do is make it so that when the text in the textbox is changed it will change the background color to green, but if its left empty it will change it to red. Ive tried adding eventhandlers but it wont run as the object isnt created until its loaded so it cant find it.
Is there anyway to change this?