• Log in or sign up for an account here: https://www.sythe.org/login

Loading Listobx

cooladrrang

Active Member
Joined
Jan 21, 2007
Sythe Gold
0
Messages
125
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
 
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
 
You're not being very clear.
You need to load items from a ListBox then put them back?
Load them to where?
 
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
 
Runescape Gamblingrunescape gambling
Back
Top