Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 22,234 times

Contents

Related Categories

Keeping VB Components Compatible - What's Right for Me

LACanadian

What's Right for Me

Now that the possibilities have been outlined, let's look at some common situations and what the optimal compatibility setting is likely to be.

A New Project Without an existing type library to be compare with, binary compatibility is meaningless. By selecting Project Compatibility, you make it easier for other projects to include a reference to your component for use in early-binding. The reason for avoiding No Compatibility is that every time to restart your component's project, a new GUID is created. Other projects that refer to your component will then develop a missing reference (see the next page for an explanation
New Version of Existing Component This is the situation that Binary Compatibility was designed to address. With this compatibility level, you can deploy your component without fear. Assuming that you follow the compatibility rules, of course.
New Version (No Backwards Compatibility) Need to go back to the drawing board? Setting No Compatibility will ensure that previous clients of your object will not be able to use the newer verion.
Changing an Existing Method's Parameter List

This is one of the more common situations. After deploying your application, you realize that an additional parameter is requlred for the enhancement you are developing. Or, to handle an unforeseen situation, one of your parameters needs to change a data type. Binary Compatibility is not possible in this situation. Unless you create another method (typically with a similar name) to perform the new functionality. For example, I might have a method called Add(A as Integer, B as Integer).

For example, I might have a method called Add(A as Integer, B as Integer) As Integer. I'm betting that you can figure out what the method actually does. But, as my component becomes more advanced, I decide to add support for Floats as well as Integers to my function. If I change the data type (to Variants, for example), I could not use Binary Compatibility. So instead, I create another method called AddB that takes variants as parameters and performs its magic. I can continue to use Binary Compatibility (my class is still Version Compatible) and any existing programs will continue to function. The only drawback is that I need to make changes to the client programs to use the new method if I want to give them access to the new features. Unfortunately, that is the price for lack of foresight in the initial design.

I am the owner of a small application development consulting company that specialized in the design and implementation of Internet-based applications. While there are others who can make a web site look good, our expertise is in making the site function. This includes infrastructure design, database design and administration, software development and deployment. For the most part, we utilize Microsoft-based languages and tools. And we are skilled enough to have generated two patent applications for our clients.

Comments

  • Removing old references

    Posted by LACanadian on 31 Jan 2003

    When I've had the same problem, I would follow these steps:

    1. Manually unregister the component with regsvr32 /u [i]path[/i].

    2. Edit the registry using your favorite tool

    3. Starting in ...

  • How to remove old references?

    Posted by dhnc on 21 Nov 2002

    Very interesting article on component compatibility. It gave me good insight in something I had trouble with during a long time already.
    I have the following question though:
    how can you remove the ...

  • Very Good

    Posted by pleitch on 10 Jul 2002

    Looks like it is straight out of a text book. I checked through it all and it is all correct. I had to by a series of advanced COM/COM++/VB and COM books to decypher - ah I mean learn - the same inf...