You could use the registry, but Microsoft recommends not using it for these types of purposes. The easiest way to do what you as is to simply write your data to a file (choose your extension) and then re-read the data when you project reopens. Something like this:
VB Code:
'============================= ' Reload your list '============================= Private Sub Form_Load() Dim FF as long Dim sData as String if Len(Trim$(DIR$(App.Path & "\list.dat")))<>0 then List1.Clear FF = FreeFile Open App.Path & "\list.dat" for Input As FF Do while not EOF(FF) Line Input #FF, sData list1.Add sData Loop Close FF End if End Sub '=================================== ' Save the List on Unload '=================================== Private Sub Form_Unload(Cancel As Integer) Dim FF as long Dim sData as string Dim x as long if Len(Trim$(Dir$(App.Path & "\list.dat")))<>0 then Kill App.Path & "\list.dat" end if FF = FreeFile Open App.Path & "\list.dat" for Binary as FF For x = 0 to (List1.listcount -1) sData = List1.list(x) & vbCRLF Put #FF, , sData Next Close FF End Sub




Reply With Quote