I need to understand how to best save listbox values when I leave a form, and later reload those values into the listbox when I go back into that form. Note that my program is running in a CE environment, so I need to be careful with resources.
I have a text box (txtScanBale) where the user keys or scans in numbers, one at a time, and as he does, I save each entry in a listbox (lstBales), with the most recent entry at the top, using this code:
If Me.lstBales.Items.Count > 200 Then
And, as shown, I limit it to the 200 most recent entries. But when I leave the form, the listbox values all go away (as far as I know), because when I come back to the form, the listbox is empty.
I'm wondering if there is an easy way to load these listbox entries into memory--maybe as an array??--either at the time I'm adding them to the listbox, or as I leave the form. Or, maybe a way to save the listbox values themselves somehow, so they don't 'disappear' when I leave the form? And then when I come back to this form, I need to be able to easily reload these entries into the listbox, in the same order they were in when I left the form.
If someone can give me a code example, or point me to a resource, it would be greatly appreciated!