VB6 Use one checkbox to select All (Round 2)

Posted on 2006-04-21
Last Modified: 2010-04-07
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
Question by:diebold1
    1 Comment
    LVL 44

    Accepted Solution

    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

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Title # Comments Views Activity
    Problem to copy file 7 43
    Mysql vs Oracle 10 104
    SSRS expression Issue finding a string 10 32
    String manipulation in Visual Basic 7 33
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    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…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now