none
C# - System.FormatException: Input string was not in a correct format.

    Question

  • Several years ago I had some software developed in C#. 

    We have several people using this software in many locations.  Today, the software began to display the following message when you try to change the COM Port settings in the software:

    System.FormatException: Input string was not in a correct format.

    The only thing that we can put it down to is a windows update, as the software has worked for years on these PC's, and only the ones that have had a windows update appear to have this problem.

    Has anyone else had this experience? (Software tried and tested for several years - then all of a sudden this error appears - System.FormatException: Input string was not in a correct format.)

    If so, does anyone have a solution for it?

    Thanks in advance, Steve.

    Tuesday, May 04, 2010 7:50 AM

Answers

All replies

  • Checkout DateTime Format of the system
    • Marked as answer by Harry Zhu Wednesday, May 12, 2010 2:18 AM
    Tuesday, May 04, 2010 12:08 PM
  • Hi,

    It's hard for us to see the problem. I found this in a thread :this exception will be thrown when you convert a null value to a meaningful value:

    You can't convert a null value to a meaningful value through Convert.  Your best option is to check for null first and then assign a value of 0 (or whatever) to the result (whereever Convert was sending its results too).

    http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/fc6b2e87-3d54-4608-b6bf-4723613333bf

    Please check out if the exception is thrown from the snippet that converts value.

    Harry


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Harry Zhu Wednesday, May 12, 2010 2:18 AM
    Monday, May 10, 2010 2:46 AM
  • WHEN WE TRY TO CONVERT SOME MEANING LESS VALUES(FORMATS) LIKE  IF IN PLACE OF WRITING 8.8, BY MISTAKE YOU WRITTEN 8..8 OR SOMETHING LIKE 8.8.8 ETC TO SOME MEANING FULL FORMAT  ,  THIS FORMAT EXCEPTION IS THROWN

    TO AVOID THIS ERROR, USE PROPER VALIDATIONS FOR CLIENT SIDE CODE(DON'T ALLOW USER TO INPUT MEANING LESS VALUES) 


    Monday, December 14, 2015 7:58 AM