Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Knowing if a property exists
Message
From
01/03/2011 18:28:35
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Knowing if a property exists
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01502282
Message ID:
01502282
Views:
96
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
Next
Reply
Map
View

Click here to load this message in the networking platform