Question Saving Setting

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
I have a queue that i want to save it to the Settings of the app, what type do i use to save it? I dont see a system.collections.generic.queue

This is the queue

Dim dlQueue As New Queue(Of ListViewItem)

and the Settings

My.Settings.dlQueue
 
You're not going to be able to save a Queue(Of ListViewItem). You'll need to flatten your data in order to save it. I'd suggest that you create a single delimited string for each item and then put those values into a StringCollection, which you can save. At startup you would create a new Queue, loop through the StringCollection, create a new ListViewItem from the string and then add it to the Queue.
 
Queue

Thanks that worked great.

Rather than a Queue(Of ListViewItem), if i just make it a Queue of delimited strings. I could just use the System.Collections.Queue to save it?
 
Thanks that worked great.

Rather than a Queue(Of ListViewItem), if i just make it a Queue of delimited strings. I could just use the System.Collections.Queue to save it?

I don't know for sure but I don't think you can save generics in app settings.
 
Generic

There is nothing under the System.Collections.Generic in settings type. But there is a System.Collections.Queue type tho. Must mean you can save a queue then? The queue seems to work fine when you add items to it and work like a queue but doesnt seem to be saving.
 
Last edited:
There is nothing under the System.Collections.Generic in settings type. But there is a System.Collections.Queue type tho. Must mean you can save a queue then? The queue seems to work fine when you add items to it and work like a queue but doesnt seem to be saving.

Queue is to Queue(Of T) as ArrayList is to List(Of T). While I haven't tried, I would guess that even if a Queue can be serialised, your ListViewItems probably can't.
 
Back
Top