Hi,
if you use Windows App you can use this demo in blank form:
Public Class Form1
Private dgv As New DataGridView With {.Dock = DockStyle.Fill}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Width = 1000
Me.Controls.Add(dgv)
dgv.DataSource = LoadDataSet()
AddHandler dgv.CellEndEdit, AddressOf dgv_CellEndEdit
End Sub
Private Sub dgv_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs)
If e.ColumnIndex < 2 Then Return
Dim row As DataRow = dt.Rows(e.RowIndex)
Dim sum As Decimal = CType(row(2), Decimal)
For i = 3 To dgv.ColumnCount - 1
Dim dec As Decimal = 0
If Not Convert.IsDBNull(row(i)) Then dec = CType(row(i), Decimal)
If dec = 0 Then
row(i) = sum
sum = 0
Exit For
End If
sum -= dec
Next
End Sub
Dim ds As New DataSet
Dim dt As New DataTable
Private Function LoadDataSet() As BindingSource
With dt
With .Columns
With .Add("Header1", GetType(Integer))
.AutoIncrement = True
.AutoIncrementSeed = -1
.AutoIncrementStep = -1
End With
.Add("Header2", GetType(String))
.Add("Total", GetType(Decimal))
.Add("Cell1", GetType(Decimal))
.Add("Cell2", GetType(Decimal))
.Add("Cell3", GetType(Decimal))
.Add("Cell4", GetType(Decimal))
.Add("Cell5", GetType(Decimal))
.Add("Cell6", GetType(Decimal))
End With
For i = 1 To 10
.Rows.Add(i, $"Row {i}")
Next
End With
ds.Tables.Add(dt)
Return New BindingSource() With {.DataSource = ds.Tables(0)}
End Function
End Class
Result: