Library code snippets

Saving combo items to a file

Here's some code to show you how to save some combo items to a file. This could be useful when creating a find history or favourites combo box. Please see 'Loading combo items from a file' for the code to re-load the data.

Private Sub SaveItems()
    Dim filenum As Integer
    Dim i As Integer

    filenum = FreeFile '// Get a free file number

    Open App.Path & "items.txt" For Output As filenum '// open the file
    For i = 0 To Combo1.ListCount - 1
        Print #filenum, Combo1.List(i) '// write each item to the file
    Next

    Close filenum '// Close the file
End Sub

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Saving combo items to a file.

Leave a comment

Sign in or Join us (it's free).