Make your own free website on

Visual Basic Tutorial Part 2 IT Career Partner For Life. Please Bookmark It.
Homework Help | Buy Book | Buy Phone | Top Web Hosts | Hire Web Designer
Home | Interview Questions And Answers | Hosting Charges | Online Tuition
Top Domain Registrars | Hire Freelancer | Employee Provident Fund | Hindi News

16. What is "Option Explicit"?

It mandates the programmer to declare the variables
before using
17. What other options are there is VB?

Option private

Option compare text,binary

Option base

18. What is the difference between Single and Double
in VB?

Single: can hold numbers that r approximations
Accuracy up to 7 digits only

Double : can hold up to 300 digits with 16 plcess
of accuracy
19. How do you clear the current selected item from a
drop down combo box?
Combo1.Remove Item(Combo1.ListIndex)

22.What is the difference between early binding and
late binding?
Early-Bound Declarations
Early binding allows you to declare an object variable
as a programmatic identifier, or class name, rather
than as an Object or a Variant data type. The
programmatic identifier of an application is stored in
the Windows registry as a subkey below the
\HKEY_CLASSES_ROOT subtree. For example, the
programmatic identifier for Access is
"Access.Application"; for Excel it is
When you are using early binding, you can initialize
the object variable by using the CreateObject or
GetObject function or by using the New keyword if the
application supports it. All Office 2000 applications
can be initialized by using the New keyword. Because
the Outlook 2000 programming environment for Outlook
items supports only scripting, you can't use early
binding declarations of any sort in its VBScript
programming environment; however, you can use early
binding in VBA code in a local Outlook VBA project or
COM add-in, or in Automation code that works with
Outlook from another host application.
Early binding is the friendly name for what C
programmers call virtual function table binding, or
vtable binding. In order to use early binding, the

host application must establish a reference to a type
library (.tlb) or an object library (.olb), or an
.exe, .dll, or .ocx file that contains type
information about the objects, methods, properties,
and events of the application or service you want to
In the following code fragment, an Application
variable is declared by using the programmatic
identifier for Word (Word.Application) and a new
instance of Word is created by using the Set statement
with the New keyword:
Dim wdApp As Word.Application
Set wdApp = New Word.Application
If the code following these lines doesn't set the
Application object's Visible property to True, the new
instance of Word will be hidden. All Office
applications are hidden by default when they are
automated from another application.
Use early binding whenever possible. Early binding has
the following advantages:
Syntax checking When you use early binding, VBA
checks the syntax of your statements against the
syntax stored in the object library during compilation
rather than checking it at run time, so that you can
catch and address errors at design time. For example,
VBA can determine if you are using valid properties or
methods of an object, and if you are passing valid
arguments to those properties and methods.
Support for statement-building tools When you use
early binding, the Visual Basic Editor supports
features that make writing code much easier and less
prone to errors, such as automatic listing of an
object's properties and methods, and pop-up tips for
named arguments.
Support for built-in constants When you use early
binding, your code can refer to the built-in constants
for method arguments and property settings because
this information is available from the type library at
design time. If you use late binding, you must define
these constants in your code by looking up the values
in the application's documentation.
Better performance Performance is significantly
faster with early binding than with late binding.
Late-Bound Declarations
Late binding allows you to declare a variable as an
Object or a Variant data type. The variable is
initialized by calling the GetObject or CreateObject
function and specifying the application's programmatic
identifier. For example, in the following code
fragment, an Object variable is declared and then set
to an instance of Access by using the CreateObject
Dim objApp As Object
Set objApp = CreateObject("Access.Application")
Late binding is the friendly name for what C
programmers used to call IDispatch binding, and was
the first method of binding implemented in

applications that can control other applications
through Automation. For this reason, you can use late
binding to maintain backward compatibility with older
applications. However, late binding uses a lot of
overhead; it is faster than dynamic data exchange
(DDE), but slower than early binding.
Tip DDE is a protocol that was established before
OLE for exchanging data between Windows applications.
There is no need to use DDE to exchange data between
Office applications because of their support for
Automation. However, you may have to use DDE from some
other application that doesn't support Automation code
in order to work with data from an Office application.
For more information about using DDE, search the
Visual B
Next topic
Previous topic