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

VB6 Check Boxes

I have a group of check boxes. They get populated with information from a database. When a user clicks the checkbox, it is supposed to save that new value. My problem is that if those boxes already have value in the database, when it is loading that information to the screen, it thinks the user click the check box, and goes to try and save it. This does not take up much time but it is a waste of resources to do all this work. Can I have my cake and eat it too?
1 Solution
You'll need to set a module-level flag indicating that the form is loading.  Like:

(declarations section)
Private mLoading As Boolean

(in the code where you're populating the controls)
    mLoading = True
    ' populate the controls
    mLoading = False

(in the click event for the checkboxes)
    If mLoading Then Exit Sub


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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