Am 31.08.2010 18:48, schrieb C:
Thanks for your quick reply.
Moreover it was limited. In VB.Net, you can create any number of
controls at runtime without being forced to create a control
array at design time. By using the Addhandler/Removehandler statement,
this is possible. You can attach/detach event handlers dynamically.
You can have one event handler handle the events of any control and
event (as long as signatures match). You can name each control
individually giving them meaningful names. You can still put all
controls into an array, or none or some of them. You can name the
event handlers like you want.
Yes, no one doubts that VB.net is a lot more powerful. But, all this
comes at the cost of more complexity. You are speaking in favour of a
50 kW motorised saw for cutting a cucumber, where people have been
using a simple knife. Your argument is that now I can cut two
cucumbers at a time, may be even two thousand, or something like that.
For engineering uses, this feels like a lot of new things to learn.
Today, I don't even understand this terminology. What are handlers I
still don't know, even though I might be using them.
As to your question: Either use the "Handles" clause or the Addhandler
statement to make a method handle an event.
But the compiler does not know of an event like lblA(3).DoubleClick.
Where do I add this stuff? Can I just create a subroutine
lblA_DoubleClick (sender, e) handles lblA.DoubleClick or something
like that, and write some code in it?
Addhandler can be used
in a loop for all labels. Within the event handler, the 'sender'
argument points to the object raising the event. If you, additionally,
want to get the index, make use of the arrays IndexOf method.
Thanks for your help. I am too primitive a beginner, so it will take
me some effort to understand how to do this.