Solved

VB6 checkbox(5) recursive calls

Posted on 2006-10-20
2
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

728 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