|
-
Dec 30th, 1999, 03:52 AM
#1
Thread Starter
Junior Member
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.
Mohammed.
-
Dec 30th, 1999, 05:07 AM
#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
loop
close #myfilex
mail me:
[email protected]
[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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|