Hi all,
I have problem with Counting running sum.
intDiff = days different between two dayTimePickers
If I click btnOne this will change my dateTimePickerToday to next day and increase intDiff to 1
I want to use intDiff as counter when ever i check some checkboxes to count total of checked boxes
Eg : btnOne click intDiff = 1, checked 3 checkboxes intSum = 3
btnOne click intDiff = 2 checked 5 checkboxes intsum = 8
My checkboxes are in group box and I'm using If and For Each loop.
I'm getting only values intSum for each time that I have checked boxes, ones for 3, and then for 5.
Thanks GaGa

8 Years
Discussion Span
Last Post by VisActualyBasic

If it's not clear I have following code:

'= groupbox containing 5 checkboxes chk1 to chk5
dtp1  and dtp2
 ' =  2 dateTimePickers
' = difference of one day each time I click button Calc
'= button calculated
Dim chk5Box As CheckBox
Din sum As Integer
' sum off all checked checkboxes for n total of day's
Dim counter As Integer
        For Each chk5Box In gpb1.Controls
            If chk5Box.Checked = True Then
                counter = counter + 1
            End If
'Gives me number of checkboxes that are checked
        Dim day1 As System.DateTime
        Dim day2 As System.DateTime
        day1 = dtp1.Value
        day2 = today.AddDays(1)
        dtp1.Value = day2
' If button Calc is pressed dtp1 progresses to next day
        Dim dtTwo As Date = dtp2.Value
        Dim dtOne As Date = dtp1.Value
        Dim intDayDif As Integer
        intDayDiff = CInt(DateDiff(DateInterval.Day, dttwo, dtOne))
' intDayDif gives me total of daysthat I have progressed, if I have clicked on 02.02.08
five time button Calc dtp1 will progress to 07.02.05 and intDayDiff will be 5

My Problem is to calculate sum of all checked checkboxes for intDayDiff,
If I progressed 2 days (ffirst day I checked 4 chkBoxes and second day3
to have sum of 7
Thanks GaGa


Hi all,
60 people have seen this thread, no any comments, its time to move on.
as there is no sugestion from any of 60 ppl for my problem I will mark this thread as solved and will post it on other forum.
Thanks GaGa

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.