how to create a log file in vb.net

I want to create a log file, how can I do this
LVL 1
SGUDAPATAsked:
Who is Participating?
 
bhmahlerConnect With a Mentor Commented:
IO.File.WriteAllText

That is a way to write to a file, and without more info of what exactly you want well, that is about all I can give ya.
0
 
SGUDAPATAuthor Commented:
let me explain I have a window form in vb.net, User can add new customer using this form, but there is some type of check from the database while doing this, only if the requirements are met the user can add a customer, I already have a code to display error message box while doing this, I also want to create a log file with these messages, How do I do this?
0
 
RamanaChoudaryCommented:
If mylog.FileExists("C:\mylog.log") = False Then
       Set createlog = mylog.CreateTextFile("C:\mylog.log", False)
   Else
       Set createlog = mylog.OpenTextFile("C:\mylog.log", ForAppending, False, TristateUseDefault)
   End If
End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.