I know this must be simple but I just can't get it I have a checkbox control
array
Check1(0) Check1(1) Check1(2)
I want to clear check1(0) and check1(2) when I check check1(1)
everything I use clears the other box's but dose not check the one I clicked
without a second click
Please help
Rick Rothstein [MVP - Visual Basic] - 24 Aug 2005 03:55 GMT
> I know this must be simple but I just can't get it I have a checkbox control
> array
> Check1(0) Check1(1) Check1(2)
> I want to clear check1(0) and check1(2) when I check check1(1)
> everything I use clears the other box's but dose not check the one I clicked
> without a second click
Try this Click event code for the control array.
Private Sub Check1_Click(Index As Integer)
If Index = 1 And Check1(1).Value = 1 Then
Check1(0).Value = 0
Check1(2).Value = 0
End If
End Sub
Rick
Randy Birch - 29 Aug 2005 03:17 GMT
Try this -- it shows how to have only one of a given option control array
checked (e.g. check #1, 0 and 2 are unchecked. Check #0, 1 and 2 a unchecked
...
Private Sub Check1_Click(Index As Integer)
Static working As Boolean
'prevent recursion
If Not working Then
working = True
Check1(0).Value = Abs(Index = 0)
Check1(1).Value = Abs(Index = 1)
Check1(2).Value = Abs(Index = 2)
'add others as required
End If
working = False
End Sub

Signature
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
----------------------------------------------------------------------------
:I know this must be simple but I just can't get it I have a checkbox control
: array
[quoted text clipped - 3 lines]
: without a second click
: Please help