Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New or CreateObject???
Message
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00513525
Message ID:
00514414
Vues:
17
I've run into an interesting, and I would way somewhat annoying, behavior related to this discussion....

Let's say that you have registered more than one class with the same name... here's a simple example -- you have a class called MyClass in "C:\My Documents." Then, you move MyClass somewhere else and register it again....

... well, regardless of which class you add to the project references, when using CreateObject(), VB grabs the first instance it finds in the registry when creating the object. I have run into this several times, and you might, too.... The NEW keyword always grabs the Project Reference file, while CreateObject might not.

I don't think this is necessarily a reason not to use CreateObject() -- it's just a gotcha to be aware of....
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform