Results 1 to 5 of 5

Thread: [RESOLVED] Run-time control and control array

  1. #1

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Resolved [RESOLVED] Run-time control and control array

    No idea how to describe this problem, but just add this to a form :

    VB Code:
    1. Option Explicit
    2.  
    3. Dim WithEvents Lst As ListBox
    4.  
    5. Private Sub Form_Load()
    6.     Set Lst = List1(0)
    7. End Sub

    List1() is a control array created at design time. Error occurs :

    459 - Object or class does not support the set of events
    Anyway to avoid it?


    Has someone helped you? Then you can Rate their helpful post.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Run-time control and control array

    You cannot use WithEvents on a control that is part of a control array.

  3. #3

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Run-time control and control array

    Simple enough I guess... Oh well Thanks


    Has someone helped you? Then you can Rate their helpful post.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] Run-time control and control array

    Control array elements have their events "hacked" to include an Index property so you know which control fired the event. That hacking can't be (or isn't anyway) done for an object reference. For the same reason, you can't use WithEvents with arrays of object references.

  5. #5

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: [RESOLVED] Run-time control and control array

    I got around this loading items and adding them to the collection of the form with "_1" or another number at the end and then referencing them through the form's controls collection again Works just fine


    Has someone helped you? Then you can Rate their helpful post.

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