Corneliu I. Tusnea
August 1st, 1999, 01:26 PM
How can I catch the events that are generated by Dynamicaly created controls.
Something like:
Dim a as VBControlExtender
...
for i = 1 to 10
a = new VB.Button
me.Control.Add a
next
So, I want to be able to get the events that are generated by those buttons.
Thanks.
Ravi Kiran
August 1st, 1999, 07:50 PM
You should use
Dim WithEvents a as TTT '( for exmpl)
But this statement should be in Declarations section of the form, and the scope is always Form-level global.
Once the above line is in place, automatically,
a will appear in the drop-down combo on the LHS of the code window. And when you select it,
any events that are associated with TTT (for ex) will the added to the combo on the RHS, and you can add event handlers, for these events by selecting them.
By Default, i think, it always adds the event-stubs for a single control. For a control array, you might have to manually add the index parameter as first element of the default event-stub that vb generates.
Ravi Kiran