
Early bind and Late bind in VB.
In a most basic sense, early-binding means that VB knows about the interface
exposed by the object. Within the IDE, this will give you the Intellisense
functionality and can potentially reduce runtime errors. However, the real
benefit is that the interface definitions get compiled into the executable.
This means the interface doesn't need to be obtained at runtime and results
in a dramatic increase in performance over late-binding. With late-binding,
your program knows nothing about the interface and must determine it at
runtime. This requires several additional calls to COM. You should use
early-binding almost all the time.
To use early-binding, you must add a reference, via the References dialog
box, to the component which exposes the object. Then, you must declared
your object variable to be that specific object type (IOW, do not declare
the object variable As Object because that will still be late-bound).
There are, however, valid reasons for using late-binding. For example, I
use late-binding for an application in order to allow clients to customize
to their specific needs. The application ships with standard features
implemented in DLLs. Some clients want or require additional functionality
(for which there is an extra fee involved). All I need to do is give them
the new DLL with the only restriction in writing the customized DLL being
that the public interface not change. Because it's late-bound, I don't need
to change the client application at all. If I used early-binding for this,
I'd have to re-write and recompile a different client EXE for every client
(customer) that wanted customization and then keep track of which client was
using which EXE, etc., etc. IOW, it'd be a real mess.
Mike
Quote:
> Hi,
> Do anybody have an ideal on "Early bind and Late bind" in VB ?
> Or can introduce me to any article on internet ?
> Thanks in advance.
> --
> XINXIN