Link to home
Start Free TrialLog in
Avatar of alangsk
alangsk

asked on

Saving and Retrieving Info From File and Populating List Box

I am creating a web browser and would like to populate a list box using an external file (i.e. text file).  However, I would like to store the information as follows:  Nickname, URL Address, Scroll Pos X, Scroll Pos Y.  This way when scrolling to a certain position on a certain page, I will be able to save that position.  When I click the favorites command button, I would like it to populate the text box from this file only showing the nickname.  Then when the nickname is selected, it would navigate to the url and to the scroll position.  The navigation and scroll position part I can do, but how can I write and read in this format.  Please help.

Thanks,

Kyle
SOLUTION
Avatar of dr_binks
dr_binks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alangsk
alangsk

ASKER

robberbaron,
How do you split the tag apart when the item is selected?  I got it to read the text file, but how do I split the tag now so that I can do something with it?  Thanks for the help.
If you are using VB6, I think the split function is available.

I'm on VB5 and have written a Parse function to do this.
'---------
Function Parse(inputline As String, sepchar As String, outarray() As String) As Integer

    Dim a As Integer, cnt As Integer, lastchar As Integer
    Dim skipspace As Boolean
   
    'add a separator to end of string to ack as
    '   end marker
    inputline = inputline + sepchar
    cnt = 0
    'count number of sepchars
    For a = 1 To Len(inputline)
        If Mid$(inputline, a, Len(sepchar)) = sepchar Then
            cnt = cnt + 1
        End If
    Next a
   
    'redimesion the array large enough to hold max
    '  possible chunks, separated by at least one
    '  sepchar
    ReDim outarray(cnt)
   
    lastchar = 0: cnt = 0: skipspace = False
    a = 1
    Do
        If Mid$(inputline, a, Len(sepchar)) = sepchar And Not skipspace Then
            If a - lastchar > 1 Then
                'found a chunk
                cnt = cnt + 1 'add to chunk counter
                outarray(cnt) = Trim(Mid$(inputline, lastchar + 1, a - lastchar - 1))
            End If
            lastchar = a  'update last found
         ElseIf Mid$(inputline, a, 1) = Chr$(34) Then
            skipspace = Not (skipspace)
        End If
        a = a + 1
    Loop While a <= Len(inputline)
           
    ReDim Preserve outarray(cnt)
   
    Parse = cnt
   
End Function
Avatar of alangsk

ASKER

Thank you to both dr binks and robberbaron!