i want to dynamically add the values in the column of a datagridview the row of which is also being created dynamically...
Form1.TextBox10.Text = total
con.Open()
cmd = New SqlClient.SqlCommand("select product,Quantity,MRP,Sale_Rate,Disc_Amt,Amt from sale_table ", con)
adapter.SelectCommand = cmd
adapter.Fill(ds)
Dim r As Integer = ds.Tables(0).Rows.Count
Dim counter As New Integer
Dim NewRow As DataRow
NewRow = ds.Tables(0).Rows(r - 1)
Form1.DataGridView1.Rows.Add(NewRow.ItemArray)
counter = Form1.DataGridView1.RowCount()
Form1.TextBox6.Text = counter - 1
total += CInt(Form1.DataGridView1.Rows(counter - 1).Cells(6).Value)
Form1.TextBox10.Text = total
adapter.Dispose()
con.Close()
total += CInt(Form1.DataGridView1.Rows(counter - 1).Cells(6).Value)
the value it displays is 0 always
plzz help