|
-
Oct 15th, 2003, 03:22 PM
#1
Thread Starter
Lively Member
how to avoid late binding ?
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"
-
Oct 15th, 2003, 03:42 PM
#2
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
-
Oct 15th, 2003, 03:55 PM
#3
Thread Starter
Lively Member
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 ??
-
Oct 15th, 2003, 03:56 PM
#4
yay gay
early binding turns all that you do later faster and cleaner..it helps you too with the exceptions etc
\m/  \m/
-
Oct 15th, 2003, 04:00 PM
#5
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.
-
Oct 15th, 2003, 04:04 PM
#6
Thread Starter
Lively Member
It's always an honor to learn from you guys !!
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
|