CDEC does not work when my application is put online

Posted on 2004-11-07
Last Modified: 2008-02-20

Ive developed an ASP.NET based website using VisualBasic.NET. I set up IIS so I could test the program as though it was on the Internet. It worked fine.

Ive now FTPed my site to a server so I can access on the Interent. The web pages look fine but the 'code behind' isn't behaving as it should. eg.

I have a string s = "-2,345.00"
When i do X = cdec(S) then x should be -2,345.00

However Im getting an exception that says it is illgal to convert this string to a decimal.
As I say this works fine on my standalone PC but it fails when I put the program online.

Any ideas?
Question by:rangers99
    LVL 28

    Expert Comment

    Hi rangers99,

    look what is written for the CDec
    CDec Decimal +/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. For numbers with 28 decimal places, the range is
    +/-7.9228162514264337593543950335. The smallest possible non-zero number is 0.0000000000000000000000000001.

    so because you have been tring to convert a number grater that 7.9228162514264337593543950335 and you have decimal places you won't be able to do that

    try with



    Author Comment

    Hi again

    Thanks for the reply. Ill give this a shot but it frankly doesn't ring true!!
    LVL 44

    Accepted Solution

    it should ne noted that this line (from the definition of CDEC)

     For numbers with 28 decimal places, the range is +/-7.9228162514264337593543950335

    means that when you want 28 digits after the decimal point that is the range,
    when 27 difits to the right:


    with 26:


    and so on:

    so "-2,345.00"
      should NOT be a problem.  The problem amy lie with the ','  try:  "-2345.00"


    Author Comment

    That was it AW. The comma was not accepted. I wrote a small function to remove commas from a string. Thanks
    LVL 44

    Expert Comment

    glad to help.


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now