Writing to a textfile

d582

New member
Joined
Mar 24, 2005
Messages
4
Programming Experience
1-3
Hi,
Does anyone know how to append the current time and date when writing to a textfile
 

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,461
Programming Experience
10+
Use the textwriter and add the information to a new line, or as required. DateTime.Now...
 

d582

New member
Joined
Mar 24, 2005
Messages
4
Programming Experience
1-3
writing to textfile

Hi,
At the moment i am doing this:-
Dim FILE_NAME AsString = "C:\test.txt"

Dim Text AsString = "Alarm Triggered"



Dim objWriter AsNew System.IO.StreamWriter(FILE_NAME, True)

objWriter.WriteLine(Text)

objWriter.Close()

what would i have to change to incorporate the Date and Time
 

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,461
Programming Experience
10+
Review the TextWriter Class and you would simply add another line "WriteLine" to add your additional information.
 

d582

New member
Joined
Mar 24, 2005
Messages
4
Programming Experience
1-3
writing to textfile

cheers that worked
 
Top Bottom