Visual Basic Tutorial Part 10

myitcareer.org-Your 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



41. What are the different levels of compatibilty that
can be set for a ActiveX component in VB and what do
they imply?
Visual Basic Concepts
Levels of Binary Version Compatibility

Visual Basic defines three levels of version
compatibility for the interfaces you describe in your
class modules.
·
Version identical means that the interfaces are all
the same, so the new version of the type library is
exactly the same as the old one. The code inside
methods or Property procedures may have been changed
or enhanced, but this is transparent to client
applications.
·
Version compatible means that objects and/or methods
have been added to the type library, but no changes
were made to existing properties or methods. Both old
and new client applications can use the component.
·
Version incompatible means that at least one
property or method that existed in the old type
library has been changed or removed. Existing client
applications that have references to the component
cannot use the new version.
Version-Identical Interfaces
Once your component has been distributed as part of an
application, there are several situations that might
cause you to release an update. You might want to
optimize the performance of a method that had turned
out to be a bottleneck for users. You might also need
to change the internal implementation of an object's
method to reflect changes in the business rule on
which the method was based.
You can change the code in existing Property
procedures or methods, and still have a
version-identical interface, as long as you do not
change the names or data types of their parameters,


the order of the parameters, the name of the property
or method, or the data type of the return value.
When you create the executable for a version-identical
upgrade, you can use the same file name for the
executable. Visual Basic uses the same version number
for the type library.
Important When you release a new version of your
component with a version-identical or
version-compatible interface, and retain the same file
name for the executable, you should always use the
Make tab of the Project Properties dialog box to
increment the file version number. This ensures that
the setup programs for applications that use your
component will replace old versions during setup.
Version-Compatible Interfaces
When you enhance your component by adding new classes,
or new properties and methods to existing classes, you
can continue to use the same name for your executable.
As long as you make no changes to existing properties
and methods, Visual Basic updates the version number
of the type library but keeps it compatible with the
old version number.
Client applications that are built using the new
version of your component will compile with the new
version number, and can make use of all the new
features. They cannot be used with earlier versions of
your component, however, because type library versions
are only upward-compatible.
As with version-identical releases, remember to
increment the file version number of the executable.
Version-Incompatible Interfaces
Sometimes design decisions made in an earlier version
of a component fail to anticipate future needs. If you
want the code in the component to be useful in new
development projects, you have to change the
interface.
For example, the CupsPerAnnum parameter of the Coffee
method might be implemented as an Integer in the first
version of a component. It may become apparent, after
the component has been in use for some time, that some
clients need to pass a larger value than can be
contained in an Integer.
Changing the declaration of a method is only one of
several actions that will cause Visual Basic to make
the version number of the type library incompatible,
rendering the new version unusable with client
applications compiled with earlier versions. The
following changes will cause a version
incompatibility:
·
Changing the Project Name field on the General tab
of the Project Properties dialog box.
·
Changing the Name property of any class module whose
Public property is True (controls), or whose
Instancing property is not Private (class modules).
·
Deleting a public class module, or setting its
Instancing property to Private.
·
Deleting a public variable, procedure, or Property

procedure from a public class module or control, or
changing it to Private or Friend.
·
Changing the name or data type of a public variable,

Next topic
Previous topic