Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New or CreateObject???
Message
De
01/06/2001 07:08:14
 
 
À
31/05/2001 20:12:15
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00513525
Message ID:
00513659
Vues:
13
>What's the difference between using New or CreateObject?.
>Is there performance reasons or rules about use one of them?.
>
>Your help will be very useful!!!
>
>Thanks guys!!!!

You can reference an object using early or late binding.
Using CreateObject, you use late binding. VB does not know of the object until the code is executed. VB can't use Intellisence to display the properties and methods in the code window and cannot check your code. Another downside to late binding is that it is slower. One benefit is that since there's no reference to the object, if it does not exist on the user's PC, your app can run and you can trap the error when trying to create the object. Another usefull use of late binding is that you can distribute new version of your objects without recompile your app.

When you put a reference to an object and use declare a variable with the New keyword, you use early binding. Benefits are: a lot faster then late binding, code checking, Intellisence.
Guy Barrette, MCSD
============
Blog http://weblogs.asp.net/guybarrette
Microsoft Regional Director, Montreal, Canada www.microsoft.com/rd
MVP, ASP.NET http://mvp.support.microsoft.com/
President, Montreal Visual Studio User Group www.guvsm.net
INETA Regional Rep for Quebec www.ineta.org
UniversalThread Magazine Columnist (.NET Books Review Column) www.utmag.com
Tech Chair French Track, DevTeach 2004 & 2005 www.devteach.com
Business Architect, Microsoft Team - Nurun Inc www.nurun.com
XBox Live Gamer Tag: Slomo QC CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform