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

create log files

100+
P: 138
hi all,
can we create a log file from vb6. i want to write it in a txt file. whenever a user does any manipulation, it should be written in a txt file. and it must continue in a same txt file. how it should be done?
any help is appreciated.
Dec 24 '07 #1
Share this Question
Share on Google+
3 Replies


debasisdas
Expert 5K+
P: 8,127
You need to use file handling for this. and call the sub routine in every event execution and save the file .
Dec 24 '07 #2

lotus18
100+
P: 866
Hi coolminded

Here is a simple way to add text in a text file:

Expand|Select|Wrap|Line Numbers
  1. Dim LogPath$
  2.     LogPath= App.Path & "\Log\"
  3.     Open LogPath & YourOutputFileName & ".txt" For Output As #1
  4.     Print #1, "Your text Line 1"
  5.     Print #1, "Your text Line 2"
  6.     Print #1, "Your text Line N"
  7.     Close #1
You can enhance the code if you want to add it on a same textfile. Hope this helps.

Rey Sean
Dec 24 '07 #3

Expert 5K+
P: 8,434
Of course, if you're going to be calling this routine to add onto an existing log, you need it to open for Append rather than for Output.
Dec 25 '07 #4

Post your reply

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