Hello I have been struggling trying to get the event to trigger based on the object that it is passed.... I am not sure if that's how it should be worded but you guys can take a look at the book and give me some insight
I am making a datagrid form, inside this form, there's a function
private void (List<string> listProducts>
{
foreach (aProduct in listProducts)
{
// reset row data
rowProduct = new string[10];
// add the row
this.dataDisplay.Tables["ProductData"].Rows.Add(rowProduct);
double checkingresult;
checkingresult = checkDiameter(aProduct);
}
Inside this form there's a function that would check the validity of the test product, so checkingresult would return 0 or 1
Then I created an event button to click on to change the color of the cell in the datagrid when it is clicked
private void bttnChecking_Click(object sender, EventArgs e)
{
DataGridViewCellStyle style = new DataGridViewCellStyle();
style.Font = new Font(datagridProductData.Font, FontStyle.Bold);
style.BackColor = Color.Red;
style.ForeColor = Color.White;
foreach (aProduct in ListProducts)
{
}
for (int i = 0; i < RowCount - 1; i++)
{
Rows[i].Cells[5].Style = style;
}
}
}
my question is, how do I pass the "checkingresult" into the event to change the color when it returns 0 or 1. Pls halp