Hi guys can you help me in this one? I can add cell values in Datagrid using their column address or column name but I want to add the columns which contain a specific word for example I want to add all cells with a column name containing "Amount"
Dim rw = 0
Dim ax = Form1.DataGridView1.RowCount - 1
Dim cl = 1
Dim dy = Form1.DataGridView1.ColumnCount
Do
Do
If Form1.DataGridView1.Columns(cl).Name.Contains("Amount") = True Then
Form1.DataGridView1.Rows(rw).Cells("Final Computation").Value += Form1.DataGridView1.Rows(rw).Cells(cl).Value
cl = cl + 1
Else
cl = cl + 1
End If
Loop While (cl < dy)
rw = rw + 1
Loop While (rw < ax)
It says Index is out of range.