• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3656
  • Last Modified:

how to create a log file in vb.net

I want to create a log file, how can I do this
0
SGUDAPAT
Asked:
SGUDAPAT
3 Solutions
 
bhmahlerCommented:
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
 
David L. HansenProgrammer AnalystCommented:
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now