Question File handling

nock8

Member
Joined
May 9, 2009
Messages
5
Programming Experience
Beginner
Hi all. I have been searching on the internet but couldn't find anything that would help me. I want my program to be able to create a '.txt' file when it is run for the first time, with the date and time the program was accessed, and to be able to add new 'logs' of program history every time it is accessed. What i mean is that i want my program to be able to create a '.txt' file, and then fill in the dates and times when the program is opened. I really need the code for this, since i can't find any help on this... Thanks in advance. :)
 
I do wonder where exactly you looked for information because there is a ton of information available on this forum and elsewhere on reading and writing text files.

Let me google that for you
 
I do wonder where exactly you looked for information because there is a ton of information available on this forum and elsewhere on reading and writing text files.

Let me google that for you


I actually gave up doing the logs thing, but actually did something different with file handling on vb.net. I know how to read and write text files, but inserting a text file with the dates and times the program was accessed was giving me a headache! I think my program is better like this :) but thank you so much for your precious link, and help. We really need moderators that are able to google things for people who ask for help in a complex and especific problem.

PS: i used yahoo ;)
 
Your original post gave no indication that you knew how to read and write files. In fact, it specifically indicated that you didn't. If you ask the question you want answered clearly then you'll likely get a clear answer, e.g.
I want to write the current date and time to a log file. I know how to write to a file but I don't know how to specifically write the current date and time.
Always read your post after writing it but before submitting it and ask yourself what it will read like to someone who has no prior knowledge of what you're doing and what you do and don't know. If you say you want to write to a file and you can find no help on the matter then that's what people will think you need help with. Be clear and avoid confusion.
 
Your original post gave no indication that you knew how to read and write files. In fact, it specifically indicated that you didn't. If you ask the question you want answered clearly then you'll likely get a clear answer, e.g.Always read your post after writing it but before submitting it and ask yourself what it will read like to someone who has no prior knowledge of what you're doing and what you do and don't know. If you say you want to write to a file and you can find no help on the matter then that's what people will think you need help with. Be clear and avoid confusion.

But i dont know how it will look like in the end. What I mean is, the process of reading and writing files could be made diffrent with the extra part of what i was looking for. Even if i didn't know how to read and write files, you could avoid making people look like fools or idiots. That's NOT for what people come here for. Even if it was a stupid question, maybe you could help instead of wasting your time looking for animated google search links to make yourself funny.

Either way, never mind... my question was resolved a long time ago in another forum. Thanks
 
lol all this for a simple pice of code, i agree with jmcilhinney though, you should have been more specific, code will look simler too:

Dim strDateTime As New System.IO.StreamWriter(File....)
strDateTime.WriteLine(Date.Now)
strDateTime.Close()

simple as that, Use the "Date.Now" to log this to file. theirs also more possibilities with this function too, Explorer! :D
 
Last edited by a moderator:
Back
Top