VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Auto Save/Load/Add/Remove to/from List Boxes

by Matthew Gates (16 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Fri 23rd June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Auto Save/Load/Add/Remove to/from List Boxes

Rate Auto Save/Load/Add/Remove to/from List Boxes



    List.AddItem txt
End Sub

Public Sub List_Load(TheList As ListBox, FileName As String)
    'Loads a file to a list box
    On Error Resume Next
    Dim TheContents As String
    Dim fFile As Integer
    fFile = FreeFile
    Open FileName For Input As fFile
    Do
        Line Input #fFile, TheContents$
        Call List_Add(TheList, TheContents$)
    Loop Until EOF(fFile)
    Close fFile
End Sub

Public Sub List_Save(TheList As ListBox, FileName As String)
    'Save a listbox as FileName
    On Error Resume Next
    Dim Save As Long
    Dim fFile As Integer
    fFile = FreeFile
    Open FileName For Output As fFile
    For Save = 0 To TheList.ListCount - 1
        Print #fFile, TheList.List(Save)
    Next Save
    Close fFile
End Sub

Public Sub List_Remove(List As ListBox)
    On Error Resume Next
    If List.ListCount < 0 Then Exit Sub
    List.RemoveItem List.ListIndex
End Sub


Download this snippet    Add to My Saved Code

Auto Save/Load/Add/Remove to/from List Boxes Comments

No comments have been posted about Auto Save/Load/Add/Remove to/from List Boxes. Why not be the first to post a comment about Auto Save/Load/Add/Remove to/from List Boxes.

Post your comment

Subject:
Message:
0/1000 characters