我在格式和转换方面遇到问题。
我已经尝试了所有解决方法,但没有。
我认为错误所在的代码片段
label_Map.Text = message.Substring(21, 3);
label_Sys.Text = message.Substring(15, 3);
label_Dia.Text = message.Substring(18, 3);
label_Pulse.Text = message.Substring(26, 3);
SaveData(
Int32.Parse(message.Substring(15, 3)),
Int32.Parse(message.Substring(18, 3)),
Int32.Parse(message.Substring(26, 3)));
示例输入字符串
S1;A0;C03;M00;P120080100;R075;T0005;;D2
错误代码结束
InnerException: System.FormatException
Message=Input string was not in a correct format.
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 NIBP2PC.Form1.display(String message) in C:\Users\bazinga\Desktop\spiediena_merisana\NIBP2PC_c#\NIBP2PC\Form1.cs:line 427