I've been trying to find a solution to this problem all day long but I have been unable to come up with the solution by myself or find it up online.
My problem is the following: I am creating an application in vb.net 2010 I have an Access DataBase connected to the project. This Database has 2 tables one is Representatives and the other one is Demos. I'm trying to provide some useful stats about the Representatives like Total Demos, Total Sells Amount (CPO), Total Recommendations, Total Demos Given and Total Demos Sold. I have been successful in getting the first 3 to work but fail to get the last 2. The problem with this one is that the data entered in to the field is a simple Yes or No and I don't know how to put in to code that if the value of the cell is Yes then to add plus 1 to the counter and if its No to add plus one to a different counter.
Here is the code that I have up to now that works for the first 3 Stats.
'To calculate the total demos when you change the Representative
Dim row As Cutco_testDataSet.DemosRow
Dim intTotalItems As Integer
For Each row In Cutco_testDataSet.Demos.Rows
intTotalItems += 1
Next
lblTotalItems.Text = intTotalItems.ToString
'Declare the variables for the values to be stored and later displayed
Dim intTotalCPO As Integer
Dim intTotalRecs As Integer
'to look in Demosdgv and add the corresponding data
For i As Integer = 0 To Cutco_testDataSet.Tables(0).Rows.Count - 1
intTotalCPO += Cutco_testDataSet.Tables(0).Rows(i).Item("CPO")
intTotalRecs += Cutco_testDataSet.Tables(0).Rows(i).Item("Rec's")
Next
lblTotalCpo.Text = intTotalCPO.ToString("c0")
lblTotalRecs.Text = intTotalRecs.ToString()
Also I'm having trouble when the value is null it tells me that it cant add DBNull. Is there anyways that the counter would just carry on and ignore if the value has not been entered yet(null) or just count null as 0.
Thanks in advance!