title: How can I detect the cell value changed of a specific datagridview column? - VB.NET
body: <p>I want to detect the cell value has been changed of a specific column.</p>
  
  <p>My Datagridview name is <code>DGV_Products</code> and it has 6 columns.</p>
  
  <pre><code>Product ID | Descriptions | Quantity | Unit Price | Discount | Amount
  G 01       |  Gallon #01  |    2     |   1850     |    100   |  3600 
  G 02       |  Gallon #02  |    1     |   1850     |    50    |  1800
  </code></pre>
  
  <p>I want to fire some code only when the <code>Quantity column</code> cell value changed not when the <code>discount column</code> value change. How can I fulfill my task? Currently the codes, what I have tried which is;</p>
  
  <pre><code> Private Sub DGV_Products_CellValueChanged(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV_Products.CellValueChanged
  
      If DGV_Products.Rows.Count &gt; 0 Then
  
          Dim Quantity As Integer = CInt(DGV_Products.CurrentRow.Cells(2).Value)
          Dim UnitProce As Integer = CInt(DGV_Products.CurrentRow.Cells(3).Value)
          Dim DiscountPrice As Integer = CInt(DGV_Products.CurrentRow.Cells(4).Value)
  
          Dim TotalDiscount As Integer = DiscountPrice * Quantity
          Dim Amount As Integer = UnitProce * Quantity
          Amount = Amount - TotalDiscount
  
          DGV_Products.CurrentRow.Cells(4).Value = TotalDiscount
          DGV_Products.CurrentRow.Cells(5).Value = Amount
  
  
          RefreshTotal()
  
      End If
  End Sub
  </code></pre>
  
  <p>*Apologies for bad english.</p>