MarkD Posted October 25, 2005 Posted October 25, 2005 OK so I managed to save an object in a collection with a key: myCollection.Add(myObject, intPK) How do I get it back using the Key rather than the Item number? :confused: Quote
*Experts* Nerseus Posted October 25, 2005 *Experts* Posted October 25, 2005 Try: myObject = myCollection(intPK) You'll likely have to cast the object coming out to whatever type myObject is. If it's a class called WhateverFun, then: myObject = DirectCast(myCollection(intPK), WhateverFun) I'm not a VB guy, so the params to DirectCast may be backwards. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.