Passing Function Values from ASP to VB Dll Function Help

I keep getting type mismath  Type mismatch: 'IRRCalc'.  Here is what I have I need to pass in array values and a percentage and this is not working for me I keep getting errors:

VB DLL:
Public Function IRRCalc(ByRef Values() As Double, ByRef Guess As Double) As String
IRRCalc = Format(IRR(Values(), Guess) * 100, "#0.00") & "%"
End Function

ASP Page:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<%
Dim objCalcVal, RetVal
Dim arrIRR(3),valGuess
arrIRR(0) = CDBL(-2465399)
arrIRR(1) = CDBL(1725956)
arrIRR(2) = CDBL(1686970)
arrIRR(3) = CDBL(1599299)
valGuess = CDBL(0.1)
Set objCalcVal = Server.CreateObject("FinancialCalcs.clsFinancialCalcs")
RetVal = objCalcVal.IRRCalc(arrIRR,valGuess)
Response.Write RetVl
%>

</BODY>
</HTML>
sbornstein2Asked:
Who is Participating?
 
fritz_the_blankCommented:
Pass the values separately rather than as an array.

FtB
0
 
Anthony PerkinsCommented:
That is because and array of variants (arrIRR) is not the same as an array of doubles (Values), or for that matter a variant (valGuess) the same as a double (Guess).
0
 
sbornstein2Author Commented:
Is there a way I can pass it the correct way to get the value from the DLL?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Anthony PerkinsCommented:
I would suggest changing your DLL to be compatible with ASP.  Is that not an option?
0
 
sbornstein2Author Commented:
Sure just not sure how to change that, I thought this would work.
0
 
hpdvs2Commented:
1.  When you get an error from a dll, the line number will typically never be correct.   You must also look for errors elsewhere in your code.

2.  Build the array in your code.  Somewhere in the general declarations of the class, put

dim dblArr() as double
dim dblArrUsed as boolean
'add the function
sub AddDbl(sVar as vaiant)
  dim i as long
  if isnumeric(sVar) then
    if dblArrUsed then
      i = ubound(dblArr) + 1
      redim preserve dblArr(i)
      dblArr(i) = cdbl(sVar)
    else
      redim dblArr(0)
      dblArr(0) = cDbl(sVar)
    end if
  end if
end sub

'then don't pass the array any more, but use the one in the class object as well.
0
 
babuno5Commented:
i think this code should solve your problem

VB DLL:
Public Function IRRCalc(ByRef Values() As Variant, ByRef Guess As Variant) As String
IRRCalc = Format(IRR(Values(), Guess) * 100, "#0.00") & "%"
End Function

0
 
sbornstein2Author Commented:
No dice:
Public Function IRRCalc(ByRef Values() As Variant, ByRef Guess As Variant) As String
IRRCalc = Format(IRR(Values(), Guess) * 100, "#0.00") & "%"
End Function

does not work the IRR Function is looking for a Double for some reason coming in so it does not compile on IRR(VALUES() it highlights Values() nest to IRR.
0
 
sbornstein2Author Commented:
hpdvs2 how then do I pass it in through the ASP and then use the function with what your suggesting?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.