Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Prevent automatically fire event in vb6

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
A short article about problems I had with the new location API and permissions in Marshmallow
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

860 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