title: handling null values when calculating average?
body: <p>I'm trying to calculate the average of bidprice but sometimes it has null values. the code i have is:</p>
  
  <pre><code> Private Sub count()
      Dim sum As Decimal
      Dim dgvr As System.Windows.Forms.DataGridViewRow
      For Each dgvr In Me.CustAgentListDataGridView.Rows
          sum += dgvr.Cells("Price").Value
      Next dgvr
      Dim n As Integer
      n = Me.CustAgentListDataGridView.Rows.Count
      Dim avg As Decimal
      If (n &gt; 0) Then
          avg = sum / n
      Else
          avg = 0
      End If
      txtavgbidprice.Text = avg.ToString("$ 0.00")
  End Sub
  </code></pre>