Microsoft KB Archive/257531

= FIX: Wrong Large Currency Values Returned From Late Bound Object =

Article ID: 257531

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q257531



SYMPTOMS
When the data type of a class property in an ActiveX DLL is Currency, and you use late binding in a client to set a large value to the property, incorrect results are returned from the property. If you use a method to retrieve the large Currency value, the same behavior results.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed

To download the latest Visual Studio service pack, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx



Steps to Reproduce Behavior
 Create a new ActiveX DLL project. Rename it to CurrDLL. Class1 is created by default.  Paste the following code in Class1's code module: Dim mCurr As Currency

Public Property Let Curr(x As Currency) mCurr = x   MsgBox "Let = " & x End Property

Public Property Get Curr As Currency MsgBox "pre-get = " & mCurr Curr = mCurr End Property  From the File menu, select Make CurrDLL.dll to compile the project, and create CurrDLL.dll. From the File menu, select New project, and select Standard EXE project. Form1 is created by default. From the Project menu, select References, check CurrDLL.dll, and then click OK. Add two TextBox controls and two CommandButton controls to Form1.</li>  Paste the following code into the code module of Form1: Private Sub Command1_Click Dim MyObj As Object Set MyObj = CreateObject("CurrDll.Class1") MyObj.Curr = Val(Text1.Text) Text2.Text = MyObj.Curr End Sub

Private Sub Command2_Click Dim MyObj As CurrDll.Class1 Set MyObj = New CurrDll.Class1 MyObj.Curr = Val(Text1.Text) Text2.Text = MyObj.Curr End Sub Private </li> Press the F5 key to run the project. Enter 922000000000000 into TextBox1, click the Late Binding button, and note that the incorrect value is displayed in TextBox2.</li> Click the Early Binding button, and note that the correct value is now displayed in TextBox2.</li></ol>

Additional query words: sp4

Keywords: kbbug kbctrl kbdll kbfix kblocalsvr kbvs600sp4fix kbvs600sp5fix KB257531

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.