943,774 Members | Top Members by Rank

Ad:
Apr 8th, 2009
0

Check Box Control Array Problem

Expand Post »
Private Sub Check1_Click()
If Check2.Value = 1 Then Check2.Value = 0
If Check3.Value = 1 Then Check3.Value = 0
If Check4.Value = 1 Then Check4.Value = 0
If Check5.Value = 1 Then Check5.Value = 0
If Check1.Value = 1 Then Text1.Text = Check1.Caption
If Check1.Value = 0 Then Text1.Text = ""
End Sub


I want to do the same with control Array :

My Code :

If Check1(Index) Then
Text1.Text = Check1(Index).Caption
Else
For k = 0 To Check1.Count
Text1.Text = ""
Check1(i).Value = 0
Next
End If

But I can not get the same result with this code. Plz help.
Similar Threads
Reputation Points: 11
Solved Threads: 1
Newbie Poster
Ravi Kant is offline Offline
13 posts
since Jan 2009
Apr 8th, 2009
0

Re: Check Box Control Array Problem

You can save yourself a lot of time and code by using an array of option buttons instead of check boxes...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Option1_Click(Index As Integer)
  2. Text1.Text = Option1(Index).Caption
  3. End Sub
and that is all the code you need...

Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Create DSN at Run time
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Form1.Show - is it a method?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC