|
-
Jul 11th, 2000, 12:52 PM
#1
Thread Starter
Member
la! how to create a simple .txt file??
thank You in advance.
Arnas
VB6
-
Jul 11th, 2000, 12:57 PM
#2
_______
<?>
Code:
'writing or reading data to or from a text file
'open for append adds the data to the end of file
'open for input opens the file for read only
'open for output opens the file and overwrites the file
'
'
Private Sub Command1_Click()
'this is the number of your file
Dim intFilenum As Integer
'set it to the next available free number
intFilenum = FreeFile
'this is your filename
Dim strFile As String
strFile = "A:\myfile.txt"
'this is the text you want to save (textbox)(string)(etc)
Dim strText As String
strText = Text1.Text
'open the file for writing to as next freefile number
Open strFile For Append As intFilenum 'see above options
'write to the file
Write #intFilenum, strText 'to read use [input #filenum,strtext]
'close the file
Close intFilenum
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 11th, 2000, 01:03 PM
#3
Hehe Joe, making it all hard for the guy to understand ;].
Code:
Open "C:\file.txt" For Output As #1 'create the file
Print #1, "This is what is going to be in the text file!" 'Write stuff inside the text file
Close #1 'Close the file
If you want it in quotes:
Code:
Open "C:\file.txt" For Output As #1 'create the file
Write #1, "This is what is going to be in the text file!" 'Write stuff inside the text file
Close #1 'Close the file
-
Jul 11th, 2000, 01:11 PM
#4
Fanatic Member
You might as well teach him right the first time.
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
|