Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to override events? (XP SP3)

    Hello everybody!

    I have a question, which is of general interest (at least I think so). I would like to know how it is possible to suppress the raising of an event. Just a simple example. Imagine you have a ComboBox with some items. For this ComboBox you have programmed a routine ComboBox_Change() which does some action. Now it is necessary to re-arrange the contents of this ComboBox. Lets do it with ComboBox.clear. Now you want everything but the Change-Event to be raised.
    Does anybody out there have an idea, how an event could be overrode?

    Any help will be appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to override events? (XP SP3)

    You could use a module-level or global variable:

    Private blnBlockEvent As Boolean

    Private Sub ComboBox1_Change()
    If blnBlockEvent Then
    Exit Sub
    End If
    ' code for On change goes here
    ...
    End Sub

    Private Sub CommandButton1_Click()
    blnBlockEvent = True
    Me.ComboBox1.Clear
    blnBlockEvent = False
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to override events? (XP SP3)

    Hello Hans!

    Sounds like it is worth a try. It sounds like a good workaround.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •