OpenAddFile




Private Sub Form_Load()
open "C:\Windows\hello.txt" For append as #1
'Opens "C:\Windows\Hello.txt" for append

print #1, "Text To print"
'Prints text to End of file

close #1
'Closes "C:\Windows\hello.txt"

End Sub

'Input opens a file and puts the text where you

'want it, if the file is not Visual Basic 'displays an error


Dim strings as string

Private Sub Form_load()
Open "C:\Windows\hello.txt" For input as #1
'Opens "C:\windows\hello.txt" for input

Input #1, strings
'Puts the text in the file in the string, strings

close #1
'Closes "C:\Windows\hello.txt"

End Sub

Private Sub Command1_Click()
label1.caption = strings
'Tells label1 To make its caption the text from the file

End Sub

'Kill deletes a file


Private Sub Form_Load()
Kill "C:\Windows\hello.txt"
'Deletes "C:'\Windows\Hello.txt"

End Sub











( openaddfile.html )- by Paolo Puglisi - Modifica del 17/12/2023