By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,099 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,099 IT Pros & Developers. It's quick & easy.

Appending data at the end of text file

P: 1
hello
I have started with visual basic and i want to know how can i append data into a text file at the end ,also fetching data from text file
Mar 19 '07 #1
Share this Question
Share on Google+
2 Replies


Dököll
Expert 100+
P: 2,364
Use:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Open App.Path + "\YourFile.txt" For Append As filenum1  
  3.  
  4.  
as opposed to

Expand|Select|Wrap|Line Numbers
  1.  
  2. Open App.Path + "\YourFile.txt" For Output As filenum1 , 
  3.  
  4.  
Output erases the whole file or existing data and adds in new data.

Hope this helps!

Dököll
Mar 20 '07 #2

100+
P: 149
hello
I have started with visual basic and i want to know how can i append data into a text file at the end ,also fetching data from text file

You can use this

Public Sub FileOpen( _
ByVal FileNumber As Integer, _
ByVal FileName As String, _
ByVal Mode As OpenMode, _
Optional ByVal Access As OpenAccess = OpenAccess.Default, _
Optional ByVal Share As OpenShare = OpenShare.Default, _
Optional ByVal RecordLength As Integer = -1 _
)

Mode can be : Append, Binary, Input, Output, or Random

So you need to use Append mode.

thanks
ansuman sahu
Mar 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.