Solved

Prevent automatically fire event in vb6

Posted on 2009-04-01
1
452 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now