Early or late binding, how?, where? when?

Early or late binding, how?, where? when?

Post by Paul Aspinal » Thu, 28 Dec 2000 00:54:36



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

Thanks

Paul

 
 
 

Early or late binding, how?, where? when?

Post by Bob Butle » Thu, 28 Dec 2000 01:28:23



Quote:> 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 Object
Early binding: Dim myvar As specifictype

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.

 
 
 

1. Early vs. Late binding

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
all.


2. Cannot connect to OWAS 3.0.2 from the network...

3. early binding to Access 97

4. How to change order by column by variable

5. Excel early binding, Error 13 - Type mismatch?

6. Updategram bug, EASY REPRO

7. Early binding and Oracle Objects for OLE

8. internal password & init.ora

9. Late Binding INSERT into a datetime field

10. Datareport Image Control Late Binding or Updating

11. late binding creating ADO objects / CLSID / correct syntax

12. Problems w/ Late Binding & ADO

13. Late Bound Forms???