Results 1 to 3 of 3

Thread: Retrieving / storing data into seperate labels

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    14

    Retrieving / storing data into seperate labels

    I have text file that needs to listed store data as follows:

    cat,black,1
    dog,brown,2

    When retriving the data I need the information to look as follows in a list box:

    Cat (Black) 1
    Dog (Brown) 2

    Is this possible? In addition, I need to store user entered data from three textboxs into the same .txt file in the the following
    manner:

    cat,black,1
    dog,brown,2

    Can any one help me.... I think I'm going insane

    Thks in advance for yr help.

  2. #2
    New Member
    Join Date
    Nov 2002
    Posts
    8
    Private Sub Form1_Load()
    On error resume next
    Open "c:\dogs.txt" for output as #1
    Print #1, "cat,black,1"
    Print #1, "dog,brown,2"
    Close #1
    Open "c:\dogs.txt" for input as #1
    Do While Not EOF(1)
    Line Input #1, variable
    List1.AddItem Split(variable,",")(0) + " (" + Split(variable,",")(1) + ") " + Split(variable,",")(2)
    DoEvents
    Loop
    Exit Sub
    End Sub

    Requirements:
    Control Listbox named List1
    Form named Form1

    Just slap that in your VB Form Code and it should work!

    GL.
    The Itch :]

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    14
    ... works a treat. Just one more quick question to make the the list box a little easier to read, is it possible to inser either a black or a "-" between each item?

    Cat - Brown - 1

    or

    Cat Brown 1

    Tks for yr help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width