Private Sub CalculateDeductionPer()

    Dim FixSumPer As Double

    Dim i As Integer
    If DataGridView1.Rows(i).Cells(9).Value Is Nothing = True Then
        For i = 0 To Me.DataGridView1.RowCount - 1
            FixSumPer += DataGridView1.Rows(i).Cells(9).Value
        Next
        i = i + 1
    End If


    Deduction.Text = FixSumPer

End Sub


this is my code to sum some cols in data grid but if some of cell = null all total of  FixSumPer = 0 , how i can fix this to get all sum 

add 0 to FixSumPer if null using
IIf(IsDBNull(DataGridView1.Rows(i).Cells(9).Value), 0, DataGridView1.Rows(i).Cells(9).Value))

This works for me.

For i = 0 To DataGridView1.CurrentRow.Index
            sum1 = sum1 + DataGridView1.Rows(i).Cells("Column1").Value
Next i
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.