Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read-only property....but.....

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
OK...here's the scenario.
I've got a object called Product, which is a singular product that can be loaded, updated from a DB.
The Product ID is a read-only property, that is generated as of the last ID and should not be set by UI.

Now, the problem is that as well as all this, I want to, as the very first thing in the app, load ALL products from the DB into a collection class, and to do this, I need to (obviously) assign those ID's from the DB to the Product (singular) object.

Of course, I cannot do this being that i've set the ID property as read-only. So...if I set it writable, then I compromise the integrity of the object by allowing UI to set this.

What is a solution for this? Any ideas are helpful...

ta much,
MG
 
If your class is not instantiable from outside your project, you could create a sub that accepts a ADODB Fields collection. Inside the sub you'd loop through the fields collection, setting your internal variables to the contents.

This would make things a little more private.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top