using WithEvents with control arrays

I would like to place a control array on a form and in my class which contains an instance of the form, i would like to receive the events from the control array.  Can this be done and if so, how?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

By using the RaiseEvent ## in your class, in one of the array events.
The raise event will send an event to the caller of the class.

emidiodAuthor Commented:

This works (not very elegant), but what i really would like is the following:

I have Form1 which has a control array of VB.CommandButtons which are Command1(0) and Command1(1).

I have a Class1 which has a module level variable with events declared as:
Private WithEvents m_oButton as VB.CommandButton

How do i set m_oButton to point to Command1 which is the control array so that i can use the following

Private Sub m_oButton_Click(Index as ingeger)

It seems to me that VB uses some hidden interface when dealing with control arrays and that i cannot use it the way i have outlined here.
>Can this be done and if so, how?
No, event parameters are not the same for control array. WithEvents does not include support for this 'Index' parameter.

Workaround: don't use control array

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.