Solved

Prevent automatically fire event in vb6

Posted on 2009-04-01
1
468 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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
A short article about problems I had with the new location API and permissions in Marshmallow
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…

776 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