Link to home
Start Free TrialLog in
Avatar of SGUDAPAT
SGUDAPATFlag for United States of America

asked on

how to create a log file in vb.net

I want to create a log file, how can I do this
SOLUTION
Avatar of bhmahler
bhmahler
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SGUDAPAT

ASKER

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?
SOLUTION
Avatar of David L. Hansen
David L. Hansen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RamanaChoudary
RamanaChoudary

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