Results 1 to 2 of 2

Thread: Type Mismatch

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    5

    Type Mismatch

    Hi,


    This is Function definition in VB6 Application (DLL)

    Public Function Main(ByVal Num As String, ByVal AcctNO As String, ByVal ChannelIn As String,ByVal CFlag As String, Optional ByVal PIn As String, Optional ByVal AccountArray As Variant,Optional ByRef MaxAvail As Double, Optional ByRef MinAvail As Double,Optional ByRef EscAmt As Double, Optional ByRef BipArray As Variant,Optional ByRef ErrCode As String, Optional ByRef InterestRate As Double,Optional ByRef SurchargeRate As Double, Optional ByRef SurChargeAmt As Double) As String


    I created a VB.net project (Visual Studio 2005) and add reference to VB6 DLL. In Button Click , i wrote.

    Code:
    xyz = abc.Main(ID, "", "Some", StrChan,StrFlag, "", , "", , , arr, str, varAccount, varAccount)
    ------------------------------------------
                                             |
                                             Here i am getting error as 
    Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

    If i pass "Y" in place of variable StrFlag like this

    Code:
     
    xyz = abc.Main(ID, "", "Some", StrChan,"Y", "", , "", , , arr, str, varAccount, varAccount)
    -----------------------------------
                                       |
                                       Now here i am getting error as 
    Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

    What is the problem? Can anybody suggest me the soultion..

    Thanks

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Type Mismatch

    It looks like your off on your parameters..

    According to your definition, here are the passable parameters...
    1) Num
    2) AcctNO
    3) ChannelIn
    4) CFlag
    5) PIn
    6) AccountArray
    7) MaxAvail
    8) MinAvail
    9) EscAmt
    10) BipArray
    11) ErrCode
    12) InterestRate
    13 SurchargeRate
    14) SurChargeAmt

    Now match them up with what you are passing

    ID, "", "Some", StrChan,StrFlag, "", , "", , , arr, str, varAccount, varAccount)

    Code:
    1) Num                ID (I'm assuming this is a string variable?)
    2) AcctNO             ""
    3) ChannelIn          "Some"
    4) CFlag              StrChan (shouldn't this be the ChannelIn parameter?)
    5) PIn                StrFlag (shouldn't this CFlag parameter?)
    6) AccountArray       ""
    7) MaxAvail            
    8) MinAvail           "" (this should be a double, not empty string)
    9) EscAmt
    10) BipArray
    11) ErrCode
    12) InterestRate
    13 SurchargeRate
    14) SurChargeAmt
    looks like things aren't being passed correctly...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width