|
-
August 1st, 1999, 01:26 PM
#1
Getting Events from Dynamicaly loaded controls
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.
-
August 1st, 1999, 07:50 PM
#2
Re: Getting Events from Dynamicaly loaded controls
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|