View Single Post
Join Date: Oct 2006
Posts: 164
Reputation: Barefootsanders is an unknown quantity at this point 
Solved Threads: 3
Barefootsanders Barefootsanders is offline Offline
Junior Poster

Re: Format single Row in datagridview using a value in same row

 
0
  #2
Sep 6th, 2007
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.

  1. private void checkForSurveyColour(DataGridView dv) {
  2. foreach (DataRow dr in dv.Rows) {
  3. if(dr.Cells["RepVisits "].ToString().Equals("Fair") || dr.Cells["RepVisits "].ToString().Equals("Poor") {
  4. dr.Cells["RepVisits"].Style.ForeColor = Color.Red;
  5. }
  6. }
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.
Reply With Quote