Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Prevent automatically fire event in vb6

Posted on 2009-04-01
1
Medium Priority
?
518 Views
Last Modified: 2013-12-26
Hello!
   I have a VB6 program with a CheckBox on a form. I have some code for the click event of the CheckBox.
   When i try to programatically change the value of the CheckBox (checked/unchecked), it automatically fires the click event of the CheckBox, executing the specified code.
   Is there a way to prevent the automatically fired event, or at least to detect when the event was automatically/manually fired?

     Thank you!
0
Comment
Question by:Cristi_E
1 Comment
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 24038258
Hi, Cristi_E.

You can't prevent the event from firing, but you can detect a manual change.  Something like this


'Declare a variable at the top of the module'
Public bolManual As Boolean
 
'In your code before setting the value of the checkbox'
bolManual = True
 
'In the event code'
If bolManual Then
    'Clear the switch'
    bolManual = False
Else
    'Code for whatever is done when the click was not a manual change'
End If

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
Loops Section Overview

885 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