3 Replies - 900 Views - Last Post: 21 November 2011 - 11:53 AM Rate Topic: -----

#1 Nandhinimani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-November 11

error "path cannot be null "how to rectify this?

Posted 21 November 2011 - 03:31 AM

Public Function WriteLog(ByVal ex As Exception, ByVal Where As String) As Boolean
        'Dim Path As String = "C:\Renergy Mini Data"
        'dir.CreateDirectory(Path)
        Dim fs As New FileStream(ErrFilePath, FileMode.Append, FileAccess.Write)
        Dim s As New StreamWriter(fs)
        s.WriteLine("DATE & TIME            :   " & System.DateTime.Now.Day & "-" & System.DateTime.Today.Month.ToString() & "-" & System.DateTime.Today.Year.ToString() & " -- " & System.DateTime.Now.Hour & ":" & System.DateTime.Now.Minute & ":" & System.DateTime.Now.Second & "")
        s.WriteLine("ERROR MSG              :   " & ex.Message & "")
        s.WriteLine("Occur At               :   " & Where & "")
        s.WriteLine("-        ~        -")
        s.Close()

        'Str = System.Reflection.Assembly.GetEntryAssembly.Location
        'If Str.Contains("PO Entry New.exe") = True Then
        '    DBPath = Str.Replace("PO Entry New.exe", "RenergyPO.mdb")
        '    dllObj.ConnectDB(DBPath)
        'End If

    End Function

This post has been edited by smohd: 21 November 2011 - 03:54 AM
Reason for edit:: Code tags added. Please use [code] tags when posting codes


Is This A Good Question/Topic? 0
  • +

Replies To: error "path cannot be null "how to rectify this?

#2 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1752
  • View blog
  • Posts: 4,409
  • Joined: 14-March 10

Re: error "path cannot be null "how to rectify this?

Posted 21 November 2011 - 04:01 AM

That seems like your ErrFilePath variable is null so do not contain the file path. Where did you give it a value?
Was This Post Helpful? 0
  • +
  • -

#3 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 221
  • View blog
  • Posts: 1,478
  • Joined: 16-March 11

Re: error "path cannot be null "how to rectify this?

Posted 21 November 2011 - 10:45 AM

Don't forget to return a value considering it's a function. ;)
Was This Post Helpful? 0
  • +
  • -

#4 xnn  Icon User is offline

  • D.I.C Head

Reputation: 36
  • View blog
  • Posts: 225
  • Joined: 10-February 10

Re: error "path cannot be null "how to rectify this?

Posted 21 November 2011 - 11:53 AM

You'll also want to close your filestream.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1