Late Binding produces DISP_E_MEMBERNOTFOUND when returned from a function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • QuickBooksDev
    New Member
    • Nov 2007
    • 6

    Late Binding produces DISP_E_MEMBERNOTFOUND when returned from a function

    I converted a large VB6 ap to VB.NET 2005.

    I have found that a Late Binding works in VB6 but not in VB. NET when a Function is used.

    Ex.

    Select Case Type
    case 1
    LineObj = Type1
    case 2
    LineObj = Type2
    end Select

    The below works without a problem
    LineObj.itemref .fullname.setva lue(mItem)


    But the below fails after it does it FindMe 438 Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERN OTFOUND))
    QBSetVal(LineOb j.ItemRef.fulln ame, mItem)

    QBSetVal does some checking and eventual does a
    pObj.setvalue(m Item)

    Public Function QBSetVal(pObj,. ....)
    pObj.setvalue(m Item)

    And the value IS SET properly but when control to returned back to the caller after the RETURN it gets the MEMBER NOT FOUND.

    I do not understand how it can set the variable properly in the object but throw the error just on the return.

    Can someone tell me what is occurring?

    Please help!!!!
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Few things i could notice:
    When you set an Object May be use "New" KeyWord..
    LineObj = New Type1case 2

    And by default the Variables passed to Function are ByVal, I Guess, you need to use "ByRef"..

    Public Function QBSetVal(ByRef pObj,.....)

    I'am not sure, but you can give it a try..

    REgards
    Veena

    Comment

    Working...