Solved

VB6 checkbox(5) recursive calls

Posted on 2006-10-20
2
256 Views
Last Modified: 2013-12-25
Hi:
I am working with VB6 and a checkbox array with 6 elements. The functionality I need is this:
When  user ckicks on checkbox(3) I want checkbox(4) and checkbox(5) = CHECKED
and
checkbox(0)checkbox(1)checkbox(2)=Unchecked.

When I wrote the code it was the chckbox_Click event gets into recursive events.
How can I accomplish the above results. Simple question please help me with sample code.
dhamijap
0
Comment
Question by:dhamijap
2 Comments
 
LVL 20

Accepted Solution

by:
hes earned 50 total points
ID: 17775001
Try this:

Private Sub chckbox_Click(Index As Integer)
   Static bBusy As Boolean ' to stop recurrision
   Dim iCnt As Integer
   Dim iIndex As Integer
   If bBusy Then
      Exit Sub
   End If

   iIndex = Index
   For iCnt = iIndex To chckbox.UBound Step 1
      bBusy = True
      chckbox(iCnt).Value = 1
      bBusy = False
   Next iCnt

   For iCnt = iIndex - 1 To chckbox.lBound Step -1
      bBusy = True
      chckbox(iCnt).Value = 0
      bBusy = False
   Next iCnt
End Sub
0
 

Author Comment

by:dhamijap
ID: 17775062
hes:
works perfect. Thanks.
dhamijap
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question