System.FormatException
HResult=0x80131537
Message=输入字符串的格式不正确。
Source=mscorlib
StackTrace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
遇到这种问题,就是字符串大概率包含了非数字的其他字符。过滤 掉或者在转换的时候提前检验一下字符串,然后弹窗提示。
处理SystemFormatException:非数字字符串解析错误
本文讲述了在遇到System.FormatException,如HResult0x80131537,即输入字符串格式不正确时,应检查字符串中可能包含的非数字字符,建议预先验证并处理这类错误,以提高程序健壮性。
3702

被折叠的 条评论
为什么被折叠?



