What is meant by "Early Binding" and "Late Binding"? Which
is better?

Answer Posted / guest

Early binding and late binding refer to the method used to
bind an interface's properties and methods to an object
reference (variable). Early binding uses type library
information at design time to reference procedures, while
late binding handles this at run time. Late binding
handles this by interrogating the reference before each
call to insure that it supports a particular method. Since
every call to a late bound object actually requires two
calls ("Do you do this?" followed by "Okay, do it then"),
late binding is much less efficient than early binding.
Except where early binding is not supported (ASP,
scripting, etc.), late binding should only be used in very
special cases.

It is a common misconception that any code using the
CreateObject function instead of Set = New is using late
binding. This is not the case. The type declaration of
the object variable determines whether it is late or early
bound, as in the following:

Dim A As Foo
Dim B As Foo
Dim C As Object
Dim D As Object

Set A = New Foo 'Early Bound
Set B = CreateObject("FooLib.Foo") 'Early Bound
Set C = CreateObject("FooLib.Foo") 'Late Bound
Set D = New Foo 'Late Bound

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the rules which should be followed while naming a variable in VB?

546


What are the uses of List View Control?

1557


___,___ arguments will be used to run a executable program in shell function

1224


what controls have you used in your project?

1476


Which language is used in visual basic?

487






What is the default model of the form?

1635


Where can I get good up-to-date information about VB?

911


how to make unlimited id(1rimjim,2rimjim,3rimjim....etc) login grp chat pogram for jabber?

1981


What is Mask Edit and why it is used?

1439


What is the difference between adodc and adodb in vb?

491


To validate a range of values for a property whenever the property values changes,which type of property procedure you use?

1431


How would you create properties in ActiveX Control?

1433


What are the types of Error? In which areas the Error occurs?

1636


Which type of object requires this object?

1581


What is Parser Bug?

1873