Hello! Can someone help me? I need to get the product of the 2 columns in the same row but my problem is the values of my datagridview come from database and the number for rows is not fixed. Thank you very much and God Bless. :)

Hi ....
try this code.........


For i = 0 To TempDataset.Tables(0).Rows.Count - 1
Dim Productvalue As Double = 0
Productvalue = Val(TempDataset.Tables(0).Rows(i)("BillAmount").ToString) * Val(TempDataset.Tables(0).Rows(i)("BillAmount").ToString)
PatientDataGridView.Rows.Add(TempDataset.Tables(0).Rows(i)("PatientID").ToString, TempDataset.Tables(0).Rows(i)("PatientName").ToString, _
TempDataset.Tables(0).Rows(i)("BillAmount").ToString, TempDataset.Tables(0).Rows(i)("Commission").ToString, Productvalue)


Next

May I ask, "BillAmount" is for what? Thanks and God Bless. :)

Be a part of the DaniWeb community

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