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

Prevent checkbox click event occur while editing it in vb6

When we fill our checkbox of our vb6 form when loading, the events are trigger and all the instructions of the event begins.

The code is for when a user checks on it, it saves to a table:

Private Sub Form_Load()
 check1.value=sql value saved previously
End Sub

Open in new window


Private Sub check1_Click()
 sql instruction save the state of the variable...
End Sub

Open in new window


However, before the screen is display, we read the table and set the checkbox according of what has been saved previously.  This trigger the "click" events and freezes the apps.

How can we set the checkbox without triggering the events?
0
rayluvs
Asked:
rayluvs
  • 5
  • 3
2 Solutions
 
Martin LissOlder than dirtCommented:
Create a Boolean variable, set it to True when editing and False when done, and in the editing routing query the value of the Boolean and exit if True.
0
 
Martin LissOlder than dirtCommented:
That should be routine and not routing.
0
 
rayluvsAuthor Commented:
Can you give an example?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Martin LissOlder than dirtCommented:
Sure. Click a check box, click the "Start Edit Mode" button and then click the same or the other checkbox. Click the "End Edit Mode" button and click a checkxox.
28981520.zip
0
 
rayluvsAuthor Commented:
We modified your code to present our problem.

We added 2 checkbox Check2 & check3

When the apps load, it sets the values in Check2 & check3 which causes the events of each click to be triggered.

What we want that when setting in form load, the events be disabled.

Set the stops at the check licks and you will see what we mean.

checkbox
0
 
Martin LissOlder than dirtCommented:
Add mbEditing = True right before Check2.Value = 1 in Form_Load.
0
 
rayluvsAuthor Commented:
Yes, it worked!  Su[er obvious and didn't see it!

Thanx!
0
 
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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