Results 1 to 5 of 5

Thread: How to direct all events from 1 type of control to the same handler? {RESOLVED}

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2003
    Posts
    26

    How to direct all events from 1 type of control to the same handler? {RESOLVED}

    How do I direct all the events of comboBox_change to one single handler.
    I need to do this because I have a set of runtime created controls, however, the numbers created is only decided during runtime.
    Last edited by weiyen; Jan 14th, 2004 at 08:11 PM.

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    How about creating enough ComboBoxes to do the job first, and setting the visible property to True or False as necessary.

    To save duplication of code you can make a sub routine and refer all the change events to this.
    Regards
    BrianB
    -------------------------------

  3. #3
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774

    Re: How to direct all events from 1 type of control to the same handler?

    Originally posted by weiyen
    How do I direct all the events of comboBox_change to one single handler.
    I need to do this because I have a set of runtime created controls, however, the numbers created is only decided during runtime.
    Usually you would use an array of controls. However I know that this is not possible with the same ease as in VB6.

    The other option would be to write a function like
    VB Code:
    1. Function AllClicks(number1, number2)
    2. 'Do something
    3. AllClicks = something 'to pass a value back if required
    4. End Function
    and simply put
    VB Code:
    1. result = AllClicks(Num1, Num1)
    and so forth for each type of event you wish to handle.

    May I ask what the disired result is?
    Code:
    IIF(Answer=Yes, "What's the disired result?", "...")
    ?
    'What's this bit for anyway?
    For Jono

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Oct 2003
    Posts
    26
    I've gotten the solution..
    Thanks

    http://www.vbforums.com/showthread.p...hreadid=273307

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2003
    Posts
    26
    I've gotten the solution..
    Thanks All

    http://www.vbforums.com/showthread.p...hreadid=273307

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