CREAR DIRECTORIO Y FICHERO EN DIRECTORIO DE LA APLICACIÓN ( Ej. log de Errores)

If Not Directory.Exists(System.AppDomain.CurrentDomain.BaseDirectory & "\LOGS") Then
      Directory.CreateDirectory(System.AppDomain.CurrentDomain.BaseDirectory & "\LOGS")
End If


Dim ficERR As String = System.AppDomain.CurrentDomain.BaseDirectory & "\LOGS\error" & errTipo & Format(Now, "yyyyMMdd") & ".log"
        
Dim sw As New System.IO.StreamWriter(ficERR, True)
       
sw.WriteLine(Format(Now, "hh:mm:ss") & "|" & errTipo & "|" & errTexto & vbCrLf)
sw.Close()
sw.Dispose()
sw = Nothing
      

No hay comentarios:

Publicar un comentario