I have been trying to find a solution. I thought that I had this right but an error occurs. "Value of type System.Array cannot be converted to Decimal. "
I'm trying to return 2 numbers from my function. One is an integer and the other is a decimal but I"m just converting the int to a decimal and trying to add it to the array I created. Here's a portion of my code:
Public Function CalcMaxBal(ByVal maxbal As Decimal, ByVal npmts As Int16, ByVal starttype As Int16, ByVal startrate As Decimal, ByVal startper As Int16, ByVal pmtadjcap As Decimal, ByVal pmtadjper As Int16, ByVal origrate As Decimal, ByVal noterate As Decimal, ByVal origbal As Decimal, ByVal totpmts As Int16, ByVal extra As Decimal, ByVal extraper As Int16, ByVal io As Int16, ByVal iocb As Boolean, ByVal miamt As Decimal) As Array
'this function is only called for a bi-weekly payment computation
Dim rpmt As Decimal=255
Dim per as Decimal =4
Dim result(2) As Decimal
result(0) = rpmt
result(1) = per
Return result
This is the crucial elements of the code. It doesn't work. result is an array of 2 decimals. Why doesn't vb.net recognize this? I said in the delegate that I"m returning an array which is what I'm returning. Is it possible to return one integer a decimal in an array or would that have to be done via a public class?
Public Function CalcMaxBal() As Decimal()? Why declare the return to be the abstract base class System.Array?Arrayclass directly, except for callingSharedmethods to manipulate array objects. ALWAYS specify the type of the array. You are creating aDecimal()inside the method so what possible reason could there be for not declaring the return type of the method to be the same? Any code that used the result you have would have to do extra work to get values of typeDecimalfrom thatArrayobject.