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

Linked list in VB

Status
Not open for further replies.

rpk2006

Technical User
Apr 24, 2002
225
IN
I have a text file with records stored in it. I am not using VB datbase
capabilities, since it consumes more resources.
I want to load the entire records in a Linked list and the user can
work on it. When he clicks save, the entire file will be overwritten.

How to create a linked list in VB?

Is my approach towards file handling correct? If not, suggest.


---------------------------------
Securing a computer system has traditionally been a battle of wits: the penetrator tries to find the holes, and the designer tries to close them. � M.Gosser
 
A real Link List isn't possible since real link list use pointers to the next and previous element. VB does not directly support pointers so you are out of luck there. But you can use collections. They provide the same functionality letting you add to a list even in the middle. You just wear some OO overhead from it but get other benifits from that too.


Hope I've been helpful,
Wayne Francis

If you want to get the best response to a question, please check out FAQ222-2244 first
 
You can quickly and easily implement linked (and doubly) linked lists through a very simple class.
 
strongm any real benifit to having a class hold references to the next class in the chain over just using a collection?


Hope I've been helpful,
Wayne Francis

If you want to get the best response to a question, please check out FAQ222-2244 first
 
Collections let you use the for..each method of visiting each of the objects in the collection (which is very nice). With a linked-list, you would have to write your own list traversal code (easy, but takes longer and is more code that could potentially go wrong).

I don't think there's much memory savings either way. The memory savings probably won't matter unless you're talking hundreds-of-thousands of objects.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Well, as ever, it depends. If the collection does the job then use it (although I think I'd recommend the dictionary object if you are going this route, since it is smaller, faster and has better functionality than the collection object)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top