You cannot use Visual Basic 2005 to read the Currency data type values back from a file
On This PageSYMPTOMSConsider the following scenario:
CAUSEThis problem occurs because the Currency data type is upgraded to the Decimal data type in Visual Basic 2005. For stand-alone Decimal data types, the Visual Basic 2005 I/O reads and writes the Decimal data type values as if they were OA Currency data type values. For Currency data type values that are inside a user-defined structure, the Visual Basic 2005 I/O reads and writes the Decimal data types without trying to convert them to an OA Currency data type. This causes Visual Basic 2005 to incorrectly read the file that you wrote by using Visual Basic 6.0. WORKAROUNDTo work around this problem, use one of the following methods. Method 1Use Visual Basic 2005 to read the Currency data type values back from the file separately, instead of reading back the user-defined structure. For example, use the following code.Method 2Use an Int64 value inside the user-defined structure. Then, use the Decimal.FromOACurrency method to retrieve the Decimal data type value from the Int64 value. To do this, follow these steps:
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. MORE INFORMATIONFor more information, visit the following Microsoft Developer Network (MSDN) Web sites: FileGet function http://msdn2.microsoft.com/en-us/library/3acfheek(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/3acfheek(vs.71).aspx) Structure declaration changes in Visual Basic http://msdn2.microsoft.com/en-us/library/030kb3e9(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/030kb3e9(vs.71).aspx) Migrate your VB6 code to VB .NET http://msdn2.microsoft.com/en-us/library/aa239677(VS.60).aspx (http://msdn2.microsoft.com/en-us/library/aa239677(VS.60).aspx) APPLIES TO
| Article Translations
|

Back to the top
