title: {change the color of DataGrid Cell after updating rows}
body: <p>basically what i want is when change the status and update it will change the color of that updated cell
  here is my code:</p>
  
  <pre><code>Private Sub Btnupdate_Click(sender As Object, e As EventArgs) Handles btnupdate.Click
      Try
          Dim datePublish As String = Format(dtpDatePublish.Value, "yyyy-MM-dd")
  
          If txtAccessionNo.Text = "" Or txtAuthor.Text = "" Or txtTitle.Text = "" Or TxtBoxISBN.Text = "" Or txtPublisher.Text = "" Or CBSection.Text = "" Or TxtBoxSubject.Text = "" Or TxtBoxYearPub.Text = "" Or TxtBoxShelf.Text = "" Or TxtBoxCallNumber.Text = "" Then
              MsgBox("All fields are required to be filled up.", MsgBoxStyle.Exclamation)
          Else
              sql = "SELECT * FROM `books` WHERE `AccessionNo` = '" &amp; txtAccessionNo.Text &amp; "'"
              reloadtxt(sql)
  
              If dt.Rows.Count &gt; 0 Then
                  panelstatus.Visible = True
                  sqledit = "UPDATE `books` SET `Isbn`='" &amp; TxtBoxISBN.Text &amp; "',
                  `BookSection` = '" &amp; CBSection.SelectedItem &amp; "', `Subject` = '" &amp; TxtBoxSubject.Text &amp; "', `Title` = '" &amp; txtTitle.Text &amp; "',
                       `Author` = '" &amp; txtAuthor.Text &amp; "', `JointAuthor` = '" &amp; txtjointauthor.Text &amp; "', `Publisher` = '" &amp; txtPublisher.Text &amp; "', 
                      `YearPublish` = '" &amp; TxtBoxYearPub.Text &amp; "', `Edition` = '" &amp; TxtBoxEdition.Text &amp; "', `Volume` = '" &amp; TxtBoxVolume.Text &amp; "', 
                     `Aquistion` = '" &amp; CBAquisition.SelectedItem &amp; "', `DateAquired` = '" &amp; datePublish &amp; "', `SponsorPrice` = '" &amp; TxtBoxPrice.Text &amp; "',
                     `Shelf` = '" &amp; TxtBoxShelf.Text &amp; "', `CallNumber` = '" &amp; TxtBoxCallNumber.Text &amp; "', `Remarks` = '" &amp; TxtBoxRemarks.Text &amp; "', `Status` = '" &amp; CBstatus.SelectedItem &amp; "' WHERE `AccessionNo` = '" &amp; txtAccessionNo.Text &amp; "'"
  
                  save_or_update(sql, sqladd, sqledit, "Books has been updated in the database.", "New books has been saved in the database.")
  
                  Call InventoryAdd_Load(sender, e)
              End If
          End If
  
      Catch ex As Exception
          MsgBox(ex.Message)
      End Try
  </code></pre>
  
  <p>here is my cell formatting code</p>
  
  <pre><code>Private Sub DtgList1_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles dtgList1.CellFormatting
      For Each row As DataGridViewRow In dtgList1.Rows
          If row.Cells(17).Value = "Available" Then
              row.DefaultCellStyle.ForeColor = Color.White
              row.DefaultCellStyle.ForeColor = Color.Red
          End If
      Next
  End Sub
  </code></pre>