Microsoft KB Archive/257531

From BetaArchive Wiki
Knowledge Base


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:

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new ActiveX DLL project. Rename it to CurrDLL. Class1 is created by default.
  2. 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
  3. From the File menu, select Make CurrDLL.dll to compile the project, and create CurrDLL.dll.
  4. From the File menu, select New project, and select Standard EXE project. Form1 is created by default.
  5. From the Project menu, select References, check CurrDLL.dll, and then click OK.
  6. Add two TextBox controls and two CommandButton controls to Form1.
  7. 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
                        
  8. 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.
  9. Click the Early Binding button, and note that the correct value is now displayed in TextBox2.



Additional query words: sp4

Keywords: kbbug kbctrl kbdll kbfix kblocalsvr kbvs600sp4fix kbvs600sp5fix KB257531