Solved

VB6 checkbox(5) recursive calls

Posted on 2006-10-20
2
257 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

860 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