Hello I am a student in computer science , we ve got a inventory system project to do. I have a problem using sql I know how to importe sql to datagridview. I know have to save data in sql database using vb but I still don t know how to calculate the difference of sum of each column from each different datagridview and to show it in datagridview. My gol is: I have a datagridview1 that shows the quantity of purchsases of a product in column A.and I have another datagridview2 that shows the quantity of sells of the same product in column B. Datagridview1 is on form1.vb. datagridview is on form2.vb0 what I want is : to calculate and view the stock the stock still available on new form3.vb on datagridview3. thanks in advance

1

There are 1 best solutions below

0
Abdel-Rahman Al-Qawasmi On

You need to follow the following steps (For selected Row):

  • Dim Data1 As String = GridView1.SelectedRow.Cells(Column Number).Text
  • Dim Data2 As String = GridView2.SelectedRow.Cells(Column Number).Text
  • Data1 - Data2
  • Save the result in a new table (database)
  • Show the new gridview3
  • Repeat for all rows.