Can anyone tell me if I should use Early or Late binding??
Which does MS recommend??
Which will be supported in future?
Should I use them for different reasons??
Which method is which?? ie, which is early and which is late
Late binding: Dim myvar As ObjectQuote:> Can anyone tell me if I should use Early or Late binding??
> Which does MS recommend??
> Which will be supported in future?
> Should I use them for different reasons??
> Which method is which?? ie, which is early and which is late
With early binding the VB compiler can look up the properties/methods/etc at
compile time and insert code directly into the app to just call them
directly. It's like having a phone with speed dial buttons pre-programmed.
It's much faster but you are locked into the number --- if the object you
are trying to use is changed and they do not maintain compatibility then you
have to recompile your client app. In the phone anaology, if they move and
change phone numbers you have to reprogram the phone.
With late binding the compiler has no idea so it puts in code to find the
information at runtime. It's like having to use the phonebook every time to
look up a number which is much slower but more flexible. If the object
changes then it's no difference to you since you'll just find the new number
when you need it.
Early binding is almost always recommended for performance. In VB.Net it's
going to be difficult to use late binding since the compiler, by default,
enforces the use of early binding and you have to go out of your way a bit
to turn that off.
I use vb3 pro and send database info to Microsoft Word 6.0 using
createobject. I have read that late binding is much faster than early
binding. Can someone please explain the difference between eaarly and
late binding and, perhaps, include a code sample of each. Thanks to