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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

collection

Status
Not open for further replies.

ChrisParks

Technical User
Feb 27, 2007
10
US
hey,

i am adding objecs to a collection

object is called securities. collection is called securitycollection

im setting variables to the properties of each "securities" object, then adding the object into the collection

i am looping thru several securities that have different properties and repeating the above process.

for some reason, whenver i change the properties of the security currently being assigned properties, it is changing the properties of ALL of the objects that are currently in the collection

does anyone know what i am doing wrong??

thanks
 
Seems you add always the same object in your collection ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
To elaborate a bit on PHV's comment, when "creating" your securities, are you creating NEW instances?

Sounds like you have a securities class that contains some properties. You are creating a security based on this class and then assigning the properties, then adding it to the collection. But when you begin working with the next security, is it instantiating a NEW instance of the class? This will give you a new security object to assign values to... If you are just using the same security object, as PHV stated, you are really just adding the same object over and over to your collection.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Hey mstrmage1768, I think that was the solution. I'll be back asking again if it isn't, but it seems to work.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top