Loading Listobx

Discussion in 'Programming General' started by cooladrrang, Mar 8, 2007.

Loading Listobx
  1. Unread #1 - Mar 8, 2007 at 5:31 PM
  2. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Loading Listobx

    what i need to do is load the items from a listbox that are in a .txt or .ini and that the items that were there that they reterun where they were at the listbox
     
  3. Unread #2 - Mar 8, 2007 at 6:14 PM
  4. slashshot007
    Joined:
    May 6, 2006
    Posts:
    164
    Referrals:
    0
    Sythe Gold:
    0

    slashshot007 Active Member

    Loading Listobx

    you can look at the code i put in the favorites thread for figuring it out.
    u need knowledge of splitting though.
    (its the updatelistbox sub that you want to look at)
    in that case, each listbox item is seperated by "(&*&)" mainly because you'll never find that text combination in a url
     
  5. Unread #3 - Mar 16, 2007 at 11:24 PM
  6. DisturbedOne
    Joined:
    Jan 21, 2007
    Posts:
    54
    Referrals:
    0
    Sythe Gold:
    0

    DisturbedOne Member

    Loading Listobx

    You're not being very clear.
    You need to load items from a ListBox then put them back?
    Load them to where?
     
  7. Unread #4 - Mar 17, 2007 at 3:07 AM
  8. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Loading Listobx

    X Zero Putting It Simple :)

    Load
    Code:
    Private Sub load_list(ByVal list As ListBox, ByVal filename As String)
            Dim info() As String = Split(FileIO.FileSystem.ReadAllText(filename), vbNewLine)
            Dim item As Integer
            list.Items.Clear()
            For item = 1 To UBound(info)
                If (info(item) <> "") Then
                    list.Items.Add(info(item))
                End If
            Next
        End Sub
    Save
    Code:
        Private Sub save_list(ByVal list As ListBox, ByVal filename As String)
            Dim info As String = ""
            Dim item As Integer
            For item = 0 To list.Items.Count - 1
                info = info & vbNewLine & list.Items(item)
            Next
            FileIO.FileSystem.WriteAllText(filename, info, False)
        End Sub
     
< SidScape Beta | [TUT] Pointers >

Users viewing this thread
1 guest


 
 
Adblock breaks this site