Is there a way to early bind the sender object from a mousemove event ?
when i use Option Strict On I receive Error message in " sender.Left"
Printable View
Is there a way to early bind the sender object from a mousemove event ?
when i use Option Strict On I receive Error message in " sender.Left"
No. The parameter is of the type Object so you can't change it but you can cast it to whatever you think it is inside the event. Just use CType to cast it to a strong type and assign it to a local variable.
VB Code:
Dim ctrl As Control=CType(sender,Control) 'ctrl.Left
It works ! Thanks
But each way will my app work faster ?? Late or early binding?
iether way at runtime it will have to do the cast , right ??
early binding turns all that you do later faster and cleaner..it helps you too with the exceptions etc
Yes early binding is always faster although I don't think the difference is as great in .NEt as it was in VB6. But in the case of events there is nothing you can do about it since the event signature must match the event delegate in the object.
It's always an honor to learn from you guys !!:D