This might help. You shouldnt have to check if its null because if its not equal to Fair or Poor it wont matter. Also, as long as you have a column within the dataview named RepVisits and you know it will be there ever single time, you dont need the try/catch.
private void checkForSurveyColour(DataGridView dv) {
foreach (DataRow dr in dv.Rows) {
if(dr.Cells["RepVisits "].ToString().Equals("Fair") || dr.Cells["RepVisits "].ToString().Equals("Poor") {
dr.Cells["RepVisits"].Style.ForeColor = Color.Red;
}
}
That is much more compact and I believe it should work the same way. The syntax might not be exactly how it should be but if you use visual studio and use the CTL + SPACE shortcuts after puting a period, it helps a lot in finding the proper method/properties you need.
Hope it helped.
Last edited by Barefootsanders; Sep 6th, 2007 at 5:42 pm.