Link to home
Start Free TrialLog in
Avatar of jakemail
jakemail

asked on

Incremental Counting

Hi, I've got a form with a 70 check boxes on it and 70 corresponding text boxes on it.  They are both control arrays.  I have coded them so that when a check box is clicked the corresponding text box next to it becomes visible.  Now what I want to do is have a number appear in the text box starting with 1 and increment up by 1 each time another check box on the form is clicked.  Thus, if a user clicked on 5 check boxes there would be 5 text boxes visible with the numbers 1 through 5 in the order that they were clicked.  I took a shot at this but only got the number 1 to appear over and over again.  I can't figure how to get a number to increment by 1 on this form.  Any help would be appreciated.  Thanks a bunch.
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jgv
jgv

If the variable 'cnt' is declared within the click event it will be reinitialized every time a check box is selected and the value would always be 1. Perhaps this is where you were experiencing a problem

Option Explicit
Dim cnt

Private Sub Check1_Click(Index As Integer)

If Check1(Index).Value = 1 Then
    cnt = cnt + 1
    Text1(Index).Text = cnt
    Text1(Index).Visible = True
End If

End Sub