在asp.net和vb.net中计算irr时出错 [英] Error in calculating irr in asp.net and vb.net
问题描述
我正在计算irr并将在运行时创建的listarray传递给irr函数,我得到错误。因为我是新来的.net
i必须计算irr
textbox2.text指定无分期付款
textbox1.text指定贷款金额
textbox5.text指定分期付款额
Dim i As Int16
Dim pay As New ArrayList()
对于i = 0 To TextBox2.Text
pay.Add(TextBox5.Text)
下一页
pay.Add(-TextBox1.Text )
Dim ir As Double
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay(TextBox2.Text + 1),0.1),2)
TextBox7.Text = ir
获取此错误消息
无法将类型为''System.Double''的对象转换为''系统.Double []''。
i am calculating irr and pass listarray created at runtime to irr function and i get error. as i''m new to .net
i have to calculate irr
textbox2.text specify the no installments
textbox1.text specify loan amount
textbox5.text specify the amount of installments
Dim i As Int16
Dim pay As New ArrayList()
For i = 0 To TextBox2.Text
pay.Add(TextBox5.Text)
Next
pay.Add(-TextBox1.Text)
Dim ir As Double
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay (TextBox2.Text + 1), 0.1), 2)
TextBox7.Text = ir
GET THIS ERROR MESSAGE
Unable to cast object of type ''System.Double'' to type ''System.Double[]''.
推荐答案
我认为在调用时参数类型存在类型不匹配以下功能:
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay(TextBox2.Text + 1),0.1),2)。
这是因为函数定义IRR中的参数类型必须与传递给函数的参数类型相匹配。
请检查函数IRR的返回类型和参数类型,以便消除错误获取。
Hi,
I think there is type mismatch in parameter types while calling the following function :
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay (TextBox2.Text + 1), 0.1), 2).
This is because the type of parameters in the function definition IRR must match the type of parameters passed to the function.
Please check the return type and parameter type of function IRR in order to remove the error you are getting.
谢谢shweta123
我认为在调用以下函数时参数类型存在类型不匹配:
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay(TextBox2.Text + 1),0.1),2)。
因为我正在传递arraylist (pay(15)as ist参数和guess(0.1)as 2nd
参数变量ir被视为double
因为irr函数只会返回irr的值将是双重
thanks shweta123
I think there is type mismatch in parameter types while calling the following function :
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay (TextBox2.Text + 1), 0.1), 2).
as i am passing arraylist (pay(15) as ist parameter and guess (0.1) as 2nd
parameter the variable ir is taken as double
as irr function will only return the value of irr which would be double
您好,
以下是解决您所得错误的方法:
1>请查看功能定义并检查您的功能正在接受的参数。
2>使用相同类型的参数调用函数。
3>如果要向函数发送不同类型的参数,那么可以通过执行类型转换方法来调用函数。
Hi,
Following is the method for solving the error you are getting :
1> Please see the function definition and check the parameters your function is accepting.
2> Call the function with same types of parameters.
3> If you are sending different types of parameters to the function then
you can call the function by doing typecasting method.
谢谢shweta123
我认为在调用以下函数时参数类型存在类型不匹配:
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay(TextBox2.Text + 1),0.1),2)。
因为我正在传递arraylist(pay(15)as ist参数和guess(0.1)as 2nd
参数变量ir被视为double
asr函数将只返回irr的值,这将是double
thanks shweta123
I think there is type mismatch in parameter types while calling the following function :
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay (TextBox2.Text + 1), 0.1), 2).
as i am passing arraylist (pay(15) as ist parameter and guess (0.1) as 2nd
parameter the variable ir is taken as double
as irr function will only return the value of irr which would be double
这篇关于在asp.net和vb.net中计算irr时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!