Solved

Is it possible to stop temporarily a event?

Posted on 2002-03-28
2
211 Views
Last Modified: 2010-05-02

.  I would like stopping a event when I fill a another control box (combo box, list box....) because VB makes a event when my combo is modified. Each time, VB launches the codes which is to link to event.


Is it possible ?
0
Comment
Question by:zoltix
2 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 6903677
You cannot stop the event.  You can however trap certain instances of the event.

Option Explicit
Private mbSel As Boolean

Private Sub Form_Load()
    Dim i As Integer

    For i = 1 To 3
        List1.AddItem "item " & i
    Next i
   
'    by setting this flag we ingnore click event from selecting item
    mbSel = True
    List1.ListIndex = 0
    mbSel = False
    'after selecting we can now capture the clicks generated by the mouse
   
End Sub

Private Sub List1_Click()
    'if the variable is true, then we want to ignore event.
    If mbSel Then Exit Sub
   
    Debug.Print "click " & List1.List(List1.ListIndex)
End Sub
0
 
LVL 1

Accepted Solution

by:
daniellyh earned 50 total points
ID: 6904462
yes i think this should be the way to skip the event in certain conditions.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

685 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