Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / August 2005



Tip: Looking for answers? Try searching our database.

Help With Checkbox Control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BigTime - 24 Aug 2005 03:25 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
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.