VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Read and Write a file(Notpad) through VB

by Dennis John (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 18th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Read and Write a file(Notpad) through VB

Rate Read and Write a file(Notpad) through VB



'Create a txt document in desktop named "Text.txt"
'Add  a command button and a textbox
'Set" multiline = true" of textbox 
Private Sub Command1_Click()
Open "C:\WINDOWS\Desktop\Text.txt" For Output As #1
Print #1, Text1.Text
Close #1
chg = 0
End Sub

Private Sub Form_Activate()
On Erorr GoTo fileError
    Open "C:\WINDOWS\Desktop\Text.txt" For Input As #1
    Text1.Text = Input$(LOF(1), 1)
    Close #1
Exit Sub
fileError:
MsgBox " Error"
End Sub

Download this snippet    Add to My Saved Code

Read and Write a file(Notpad) through VB Comments

No comments have been posted about Read and Write a file(Notpad) through VB. Why not be the first to post a comment about Read and Write a file(Notpad) through VB.

Post your comment

Subject:
Message:
0/1000 characters