Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Knowing if a property exists
Message
De
01/03/2011 18:28:35
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Knowing if a property exists
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01502282
Message ID:
01502282
Vues:
97
What is the best way to code to know if a property exists? Basically, I have a class which contains a lot of most commonly used labels. Sometimes, I have to go get the string from that class, from one of its property, such as oProcess.oLabel.cFirstName and oProcess.oLabel.cCity, for example, which would return "First name" and "City".

But, if someone types something like oProcess.oLabel.cAPropertyNameThatDoesNotExist, this will generate an error in the designer. So, what would be the proper approach to code it so the designer will not complain and I will be able to skip a portion of code if the property does not exist?

I am looking for something like:
' If the property exists
If Not IfPropertyExist("oProcess.oLabel.cCity") Is Nothing
   Something
End If
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform