B
Brett
I've compiled a DLL which is being called from a different project. The
following code is from the DLL. When I run the WriteToFile sub the second
time from the spawning project, I get the error that follows.
Imports Microsoft.VisualBasic
Public Shared Sub WriteToFile(ByVal FilePath As String, ByVal FileName As
String, ByVal FileContent As String)
Dim txtfile As Object
Dim fso = CreateObject("Scripting.FileSystemObject")
If Microsoft.VisualBasic.Right(FilePath, 1) = "\" Then
FilePath = FilePath & "\"
End If
txtfile = fso.OpenTextFile(FilePath & FileName, 2, True)
txtfile.WriteLine(FileContent)
txtfile.WriteLine()
End Sub
The following error occurs on this line:
If Microsoft.VisualBasic.Right(FilePath, 1) = "\" Then
Error is:
An unhandled exception of type 'System.Security.SecurityException' occurred
in microsoft.visualbasic.dll
Additional information: Exception from HRESULT: 0x800A0046
(CTL_E_PERMISSIONDENIED).
Any suggestions what the error means or why it only occurs on the second
call to this method?
Thanks,
Brett
following code is from the DLL. When I run the WriteToFile sub the second
time from the spawning project, I get the error that follows.
Imports Microsoft.VisualBasic
Public Shared Sub WriteToFile(ByVal FilePath As String, ByVal FileName As
String, ByVal FileContent As String)
Dim txtfile As Object
Dim fso = CreateObject("Scripting.FileSystemObject")
If Microsoft.VisualBasic.Right(FilePath, 1) = "\" Then
FilePath = FilePath & "\"
End If
txtfile = fso.OpenTextFile(FilePath & FileName, 2, True)
txtfile.WriteLine(FileContent)
txtfile.WriteLine()
End Sub
The following error occurs on this line:
If Microsoft.VisualBasic.Right(FilePath, 1) = "\" Then
Error is:
An unhandled exception of type 'System.Security.SecurityException' occurred
in microsoft.visualbasic.dll
Additional information: Exception from HRESULT: 0x800A0046
(CTL_E_PERMISSIONDENIED).
Any suggestions what the error means or why it only occurs on the second
call to this method?
Thanks,
Brett