• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

VB6 Use one checkbox to select All (Round 2)

I asked this question earlier and thought I received a good answer and perhaps it was good but I didn't understand the answer correctly.

I have a form that has 7 checkboxes for various choices and I want to also have a checkbox to select all. Please note: I am a newbie so please be detailed in your reply.

Thanks in advance AJS
0
diebold1
Asked:
diebold1
1 Solution
 
aikimarkCommented:
in the click event of that special checkbox code the following, assuming that the name of the special checkbox is chkSpecial.

Dim ctlThing as Control
For Each ctlThing in me.controls
  If typeof ctlThing is checkbox Then
    If ctlThing.Name <> "chkSpecial" Then
      ctlThing.Value = chkSpecial.Value
    End If
  End If
Next

=============================
This will set all checkboxes to the same state as the special checkbox.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now