VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A way to input / write from/to .txt files

by ComputerWhiz (4 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

This is only for beginners and the advanced guys will know it ..The following lines of code will teach you how to input from .txt files and how to write to .txt files ....
Votes and Comments are highly appreciated !
Happy Programming

Rate A way to input / write from/to .txt files

Make a label and name it lblInput1
Make a .txt file in the same folder as the project .and name it as InputFile
make a command button ,name it cmdWrite
make a textbox and name it txtInput
Now ,in the Form_load() event ,add this code -
dim txtVar1 as string
open app.path + "\inputfile.txt" for input as #1 
input #1, txtvar1
txtvar1 = lblinput.caption
close #1

Now to write to .txt files
In the cmdwrite_click() event -
open app.path + "\inputfile.txt" for append as #2
write #2, txtinput
close #2

Download this snippet    Add to My Saved Code

A way to input / write from/to .txt files Comments

No comments have been posted about A way to input / write from/to .txt files. Why not be the first to post a comment about A way to input / write from/to .txt files.

Post your comment

Subject:
Message:
0/1000 characters