473,395 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Microsoft.VisualBasic.Financial.IRR - Error in C#

Hi,

This is my first post, but have been an avid reader up until to now. Great resource though.

Anyway, onto my problem.

I need to use the Microsoft.VisualBasic.Financial.IRR procedure in my C# / ASP.NET 2.0 application.

The code I am using is shown below:-

Expand|Select|Wrap|Line Numbers
  1. Decimal monthlyROI = 0;
  2. Decimal ROI = 0;
  3. Double estimate = 0.1;
  4. Double[] irrArray;
  5. ArrayList irrArrayList = new ArrayList();
  6.  
  7. irrArrayList.Add((Double)Decimal.Negate(amountOfCredit));
  8.  
  9. for (int termLoop = 0; termLoop < (term - 2); termLoop++)
  10. {
  11.      irrArrayList.Add((Double)standardFinancePayment);
  12. }
  13.  
  14.  irrArrayList.Add((Double)Decimal.Add(monthlyFinancePayment, finalPayment));
  15.  
  16. irrArray = (Double[])irrArrayList.ToArray(typeof(Double));
  17.  
  18. monthlyROI = (Decimal)Microsoft.VisualBasic.Financial.IRR(ref irrArray, estimate);
  19.  
  20. ROI = Decimal.Multiply(monthlyROI, 12);
  21.  
  22. return ROI;
When I run this peice of code, the call to Microsoft.VisualBasic.Financial.IRR raises an exception, "Arguments Are Not Valid".

I thought it might have been to do with using the array list, and then populating the array with the contents of it.

I tried just using a standard Double Array and then assigning its size when it was instantiated. THis too didnt work.

The only way I can get this function to work correctly is by instantiating the array with values at design time as follows:-

Expand|Select|Wrap|Line Numbers
  1. Double[] irrArray = {-22500.00, 770, 770, 600, 500, 7770, 666,555,444,666,666};
I am sure I am missing something really simple here and any guidance would be really appreciated.

Regards

Simon
Apr 14 '08 #1
0 2147

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RitaG | last post by:
Hi. I have a utility program that has a form that allows a user to select a file. I'm then using the LEFT Function to get some information. sNewFilePathName = Left(sFilePathName, iCnt) I'm...
2
by: darrel | last post by:
I've built a control. At the top of my control, I have this: Imports Microsoft.VisualBasic Then, later, I call a function like this: DateTime.Now.Year.ToString() This works fine on my...
15
by: Phill. W | last post by:
Is anyone writing VB.Net (2003) code /without/ referencing the Microsoft.VisualBasic namespace(?), regardless of whether its Import'ed or not? The Powers That Be here are trying to introduce a...
14
by: frostalicious | last post by:
Used VB.NET (on my client PC) to convert VB6 executable to .NET executable. Placed the .exe file on a network drive on my server. From client, ran .NET Wizards "Trust an Assembly" to make the...
2
by: Steve | last post by:
Having only recently migrated across from VB6 to VB.NET I'm still unsure whether or not I should be making (heavy) use of the Microsoft.VisualBasic namespace in new applications. I've read a lot...
9
by: Alexander Baranovsky | last post by:
Hello friends, How I can determine full path of Microsoft.Basic.dll? Thanks, Alexander
1
by: Tom Kearney | last post by:
Hi - I'm trying to use "Microsoft.VisualBasic.Logging.FileLogTraceListener" from a set of C# aspx web pages, but I can't seem to use: <%@ Import Namespace="Microsoft.VisualBasic.Logging" %> I...
0
by: Jens Jensen | last post by:
High, There seem to be a financial class accessible from .Net 2.0 . Has anyone used this? Any sample codes/experience using it? Thanks JJ
16
by: cj | last post by:
I am under the impression they are obsolete methods included for backward compatibility. For instance is using filedatetime("c:\myfile.txt") still the accepted way of getting the date...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.