Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 15th, 2005, 01:14 PM
Registered User
 
Join Date: Sep 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help

I need to know how this is done in vb.net,thanks

On Error Resume Next
    Dim f As Integer
    f = FreeFile
    Open App.Path & "\Errors.log" For Append As #f
    Print #f, Format(Now, "mm/dd/yyyy") & " " & Format(Now, "hh:nn:ss") & " - "; p_sError
    Close #f

    If p_bDisplay Then
        MsgBox p_sError, vbCritical + vbApplicationModal
    Else
End If
 
Old September 19th, 2005, 11:00 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Code:
    On Error Resume Next

    ' True (below) = Append.  Will create if file does not exist.
    Dim SW As New StreamWriter(App.Path & "\Errors.log", True)

    SW.WriteLine(Format(Now, "mm/dd/yyyy") & " " & _
                        Format(Now, "hh:nn:ss") & " - " & _
                        p_sError)

    SW.Close()
    SW = Nothing

    . . .


(App.Path might need to be changed. I don't believe that will work in .NET; not sure though.)









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.