How do you save the contents of a Listbox?

  • Thread starter Thread starter Joe Fallon
  • Start date Start date
J

Joe Fallon

I need to save the contents of a listbox in a serializable object.
I not only need the values but the index positions as well.

For example, a listbox with 3 entries may look like this:
Index Value
0 x
1 y
2 z

What should I store these in? (An array, hashtable, etc)
What is the simplest way to move the values from the list box to the new
object?

Thanks!
 
Joe said:
I need to save the contents of a listbox in a serializable object.
I not only need the values but the index positions as well.

For example, a listbox with 3 entries may look like this:
Index Value
0 x
1 y
2 z

What should I store these in? (An array, hashtable, etc)
What is the simplest way to move the values from the list box to the
new object?

Thanks!

If you really need the index, I would use a hash table.
I would reccomend just using an ArrayList, and its built-in indices.

- Pete
 
Back
Top