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[]'.
10 3797
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.
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
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.
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
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.
hi shweta
irr function returns value of irr which is of type double and the double variable is used to hold the value
PRR 750
Expert 512MB
First and foremost you should use conversion of string for surety that your inputs are right....
Convert.ToInt() or Convert.ToDouble(); -
-
int i;
-
ArrayList pay =new ArrayList();
-
// Better Option is
-
List<int> pay1=new List<int>();
-
-
//For i = 0 To TextBox2.Text??
-
// What exactly are you doin here?
-
//for(int 0;i<Convert.ToInt32(TextBox.Text);i++)//
-
-
ir = //YOURFUNCTION(pay[index],0.1,2);
-
//(pay (TextBox2.Text + 1), 0.1), 2)
-
// what exactly are you passing in the function?
-
-
thanx dirtbag
I am developing application for loan purposes and i have to calculate irr
textbox2.text specify the no installments
those no equal installments are added to arraylist -
//For i = 0 To TextBox2.Text??
-
// Add elements of array list
-
//for(int 0;i<Convert.ToInt32(TextBox.Text);i++)//
-
-
ir = //YOURFUNCTION(pay[index],0.1,2);
-
//(pay (TextBox2.Text + 1), 0.1), 2)
-
// what exactly are you passing in the function?
-
passing arraylist (pay(x) as ist parameter and guess (0.1)
as i have also mentioned whole problem in my posts
thanks again for response
PRR 750
Expert 512MB
thanx dirtbag
I am developing application for loan purposes and i have to calculate irr
textbox2.text specify the no installments
those no equal installments are added to arraylist
<code>
//For i = 0 To TextBox2.Text??
// Add elements of array list
//for(int 0;i<Convert.ToInt32(TextBox.Text);i++)//
ir = //YOURFUNCTION(pay[index],0.1,2);
//(pay (TextBox2.Text + 1), 0.1), 2)
// what exactly are you passing in the function?
</code>
passing arraylist (pay(x) as ist parameter and guess (0.1)
as i have also mentioned whole problem in my posts
thanks again for response
where exactly have you got d prob? post some code n error message...
hi dirtbag
'code Starts
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
'code Ends
GETTTING THIS ERROR MESSAGE
Unable to cast object of type 'System.Double' to type 'System.Double[]'.
PRR 750
Expert 512MB
hi dirtbag
'code Starts
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
'code Ends
GETTTING THIS ERROR MESSAGE
Unable to cast object of type 'System.Double' to type 'System.Double[]'.
As far as i can see your function returns Double[] ; so declare double array ..
Dim ir as Double[]; or in C#
double[] ir;
could any body has solved my problem as i am not getting the solution yet
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ron Adam |
last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone
here for a great programming language.
Below is my first Python program (not my first program) and I'd
apreciate any...
|
by: Kasp |
last post by:
Hi there,
I am trying to make an OLAP cube on a table having two columns (datetime,
Number_of_times_an_event_occured).
My dimension is time and I want to measure the Min and Max times an event...
|
by: Adam |
last post by:
Hi!
I've modified a javascript order form calculation script that tallies
up the subtotal, shipping/handling, and total automatically.
I did some modifications and it still worked fine, even...
|
by: Joe Bongiardina |
last post by:
What does the message "calculating...." mean in the lower left status area
of a form?
I have a form with no calculated, concatenated or lookup fields, yet it
displays this msg.
The form takes...
|
by: jlm |
last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time
(time taken off for Administrative, Annual, Sick, Compensation leave).
I have EmpID, LeaveDate, LeaveType, LeaveHours fields on...
|
by: Chris Baxter |
last post by:
In my program I am trying to do a simple calculation of 5.1 * 100 which
should =510 if my gradeschool level math is correct. My problem is vb.net
is returning 509.99999999999994 as the answer. Am...
|
by: whitehorse |
last post by:
When the warehousecontroller service is invoked, the following error message
is sent to the application log:
Event Type: Error
Event Source: TFS Warehouse
Event Category: None
Event ID: 3000...
|
by: Lisa |
last post by:
In translating the formula for calculating lottery odds for various
conditions into a Visual Basic Program, I have apparently missed something
in that I get errors in the part of the calculation...
|
by: sumit kale |
last post by:
Hi,
Can somebody help me resolve my problem ?
I am getting error when calculating total using unbound textfiled in subform.
I have a main form called purchase_register_master and a subform...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |