I want to create a function in VB6 where I need to pass an array to and a percent value and then return a calculation through VB. I then need to call this function in an ASP page and pass the array of values where there will be 4 and a percent value then I want to return the value in like RetValue variable. I am rusty at using VB6 dll's within ASP. Can someone provide me with an example on how to accomplish this? Here is what I want to create in VB6 DLL function and then call this in an ASP page returing the value where I will response.write it out. Here is the function its for a financial function where I want to use a VB6 DLL to handle all these larger calculations and keep it out of my ASP code except for the call to complete the calc.
Dim Guess, RetRate, Values(4) As Double
Dim Fmt, Msg As String
Guess = 0.1 ' Guess starts at 10 percent.
Fmt = "#0.00" ' Define percentage format.
Values(0) = -2465399 ' Business start-up costs.
' Positive cash flows reflecting income for four successive years.
Values(1) = 1725956: Values(2) = 1686970
Values(3) = 1599299
RetRate = IRR(Values, Guess) * 100 ' Calculate internal rate.
Msg = "The internal rate of return for these four cash flows is "
Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
MsgBox (Msg) ' Display internal return rate.
I need to complete the above and the Values pass as an array to it and then return the RetRate. I want to play with this over the weekend to see if I can start a new financial calc DLL to use. Thanks all.