article

A way to input / write from/to .txt files_*

Email
Submitted on: 1/29/2015 10:10:00 PM
By: ComputerWhiz (from psc cd)  
Level: Beginner
User Rating: By 9 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 1077
 
     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

 
				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


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.