Results 1 to 3 of 3

Thread: [2005] How to determine which event has triggered a handler

  1. #1

    Thread Starter
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    [2005] How to determine which event has triggered a handler

    Code:
    Private Sub cboBuilding_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboBuilding.SelectedIndexChanged, cboBuilding.LostFocus
    
    End Sub
    What can I do in the above procedure, which handles two of a combo box's events, to determine which event has called it?
    This world is not my home. I'm just passing through.

  2. #2
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Re: [2005] How to determine which event has triggered a handler

    Check if selected index is changed from the previous value then cboBuilding.SelectedIndexChanged is fired otherwise lost focus event is fired.

  3. #3

    Thread Starter
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: [2005] How to determine which event has triggered a handler

    You're suggesting I have a static variable in the procedure to remember the previous index? Thanks, this would work, but I'm sure there must be a way of finding out which event is being handled.

    Obviously I could also write two separate handlers, one to handle each event...

    I don't understand how EventArgs contains no information about the event.
    This world is not my home. I'm just passing through.

Posting Permissions

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



Click Here to Expand Forum to Full Width