We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 13,138 times

Related Categories

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

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments