The following exception occurred in DataGridView: System.Exception: Is not a valid value for Decimal. ---> System.FormatException: The input string is not properly formatted.

Source: Internet
Author: User

In fact, I did not detect the problem before, but one put on the test hand on the out, the reason I know where to change what things, but people do not know AH. The error is as follows:

---------------------------DataGridView Default error dialog box---------------------------The following exception occurred in DataGridView: System.Exception: Is not a valid value for Decimal. --->system.formatexception: The input string is not in the correct format. In System.Number.StringToNumber (String str, NumberStyles options, Numberbuffer&Number , NumberFormatInfo info, Boolean parsedecimal) in System.Number.ParseDecimal (String value, NumberStyles option S, NumberFormatInfo numfmt) in System.ComponentModel.DecimalConverter.FromString (String value, NumberFormatInfo FormatInfo) in System.ComponentModel.BaseNumberConverter.ConvertFrom (ITypeDescriptorContext context, CultureInfo Culture, Object value)---the end of the inner exception stack trace---in System.ComponentModel.BaseNumberConverter.ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, Object value) in the System.ComponentModel.TypeConverter.ConvertFrom (object value) System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue (Int32 boundcolumnindex, Int32 columnindex, Int32 RowIndex, Object value) to replace this default dialog box, handle the DataError event. ---------------------------Determine---------------------------

Workaround, register a dgv_dataerror event to be able.

private void Dgv_dataerror (object sender, Datagridviewdataerroreventargs e)
{

Can not execute code OH

}

The following exception occurred in DataGridView: System.Exception: Is not a valid value for Decimal. ---> System.FormatException: The input string is not properly formatted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.