N
Nate
This has probably already been addressed (but I can't find a reference
to it in the groups). Tracking down a bug, I found that the OpenMode
Enumeration in both the local and on-line MSDN is incorrect. It's a
problem in .NET 2003; not sure if it has changed since then.
According to the MSDN:
OpenMode.Input specifies file opened for write access
OpenMode.Output specifies file opened for read access
but using this gives an exception: "Valid values for Output mode are
'OpenAccess.Write' and 'OpenAccess.Default'."
To test this, run the following code:
Public Enum FileMode
Write
Read
End Enum
Public Sub OpenFile(ByVal filename As String, ByRef type As
FileMode)
Dim mode As OpenMode
Dim access As OpenAccess
Select Case type
Case FileMode.Read
mode = OpenMode.Input
access = OpenAccess.Read
Case FileMode.Write
mode = OpenMode.Output
access = OpenAccess.Write
End Select
iFileNum = FreeFile()
sFileName = filename
FileSystem.FileOpen(iFileNum, filename, mode, access)
End Sub
I just wanted to get this out there in case it's confused anyone else.
to it in the groups). Tracking down a bug, I found that the OpenMode
Enumeration in both the local and on-line MSDN is incorrect. It's a
problem in .NET 2003; not sure if it has changed since then.
According to the MSDN:
OpenMode.Input specifies file opened for write access
OpenMode.Output specifies file opened for read access
but using this gives an exception: "Valid values for Output mode are
'OpenAccess.Write' and 'OpenAccess.Default'."
To test this, run the following code:
Public Enum FileMode
Write
Read
End Enum
Public Sub OpenFile(ByVal filename As String, ByRef type As
FileMode)
Dim mode As OpenMode
Dim access As OpenAccess
Select Case type
Case FileMode.Read
mode = OpenMode.Input
access = OpenAccess.Read
Case FileMode.Write
mode = OpenMode.Output
access = OpenAccess.Write
End Select
iFileNum = FreeFile()
sFileName = filename
FileSystem.FileOpen(iFileNum, filename, mode, access)
End Sub
I just wanted to get this out there in case it's confused anyone else.