Adblock breaks this site

Loading Listobx

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

  1. cooladrrang

    cooladrrang Active Member

    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0
    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
     
  2. slashshot007

    slashshot007 Active Member

    Joined:
    May 6, 2006
    Posts:
    164
    Referrals:
    0
    Sythe Gold:
    0
    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
     
  3. DisturbedOne

    DisturbedOne Member

    Joined:
    Jan 21, 2007
    Posts:
    54
    Referrals:
    0
    Sythe Gold:
    0
    Loading Listobx

    You're not being very clear.
    You need to load items from a ListBox then put them back?
    Load them to where?
     
  4. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    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 >


 
 
Adblock breaks this site