Results 1 to 2 of 2

Thread: text file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Columbus, OH, USA


    Any time I tried to creat a text file, than open it for any reason, I get different error message. Please, can I get a example program to:
    - How creat a text file?
    - How to add a record to this file, after loadinf the form, or program?
    - How can display the contents of the file in treeview or listbox?
    Thank you,
    NOTE: I just start learning using VB, so I do appreciate any help.

  2. #2


    to start a file:
    (dont declare FreeFile)

    MyData = "hello Mohammed"
    MyFile = Freefile
    Open "C:\ThisFile.txt" for output as #MyFile
    print #MyFile, MyData
    print #myfile, "!!!"
    close #myfile

    try this code and then use notepad to open the file (C:\ThisFile.txt) then you'll see what ive done.

    to add to the end of this original file swap the word Output for "Append" in the above code.

    to put all the data from the file into a listbox:

    MyfileX = Freefile
    open "C:\ThisFile.txt" for input as #myfilex
    do while not EOF(MyFilex)

    line input #myfilex, LineString
    list1.additem LineString


    close #myfilex

    mail me:

    [This message has been edited by wossname (edited 12-30-1999).]

    [This message has been edited by wossname (edited 12-30-1999).]

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