BUG: "Type System.IO.IOException" error message after you upgrade to Visual Basic .NET or Visual Basic 2005 (316155)
The information in this article applies to:
- Microsoft Visual Basic 2005 Express Edition
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
This article was previously published under Q316155 SYMPTOMS After you upgrade your Microsoft Visual Basic 6 application
to Visual Basic .NET or Visual Basic 2005, you may receive the following "exception" error message:
An unhandled exception of the type
'System.IO.IOException' occurred in microsoft.visualbasic.dll.
CAUSE This behavior occurs when all of the following conditions
are true:
- The Visual Basic Upgrade Wizard upgrades Visual Basic 6
code that uses the Open statement to open a given file.
-and- - You do not explicitly specify shared access to open this
file.
-and- - You attempt to open this file a second time without first
closing it.
NOTE: You may also receive this error message if you try to open a
given file a second time (without closing the first file handle) by using the FileOpen function in Visual Basic .NET or in Visual Basic 2005 without specifying the Share
argument. RESOLUTION One of the parameters of the FileOpen method takes a parameter of type OpenShare. OpenShare is an enumeration. By passing OpenShare.Shared to FileOpen, you can open the file with shared access. This allows you to
maintain more than one handle to an open file at a time. The following sample
code uses FileOpen and OpenShare.Shared:
FileOpen(fn2, strFile, OpenMode.Input, , OpenShare.Shared)
NOTE: The documentation for the share parameter of the FileOpen method is incorrect. STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Major | Last Reviewed: | 1/27/2006 |
---|
Keywords: | kbvs2005applies kbvs2005swept kbvs2002sp1sweep kbmigrate kbbug kberrmsg KB316155 |
---|
|