作者tnek (kent)
看板C_Sharp
标题运算後 值填入datagridview
时间Thu Jul 17 15:08:49 2014
大家好
想请问一个问题
我今天想将datagridview中的值做运算
然後结果填到datagridview另一个储存格里
程式码如下
dataGridView2[0, 2].Value = double.Parse(dataGridView2[0, 9].ToString()) /
(double.Parse(dataGridView2[0, 1].ToString()) * 1000);
其中dataGridView2[0, 9]为一7位数以上的整数
dataGridView2[0, 1]为一小位数有两位的数
但会出现错误:
类型 'System.FormatException' 的未处理例外状况发生於 mscorlib.dll
其他资讯: 输入字串格式不正确。
想请问这要怎麽解决呢??
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 220.135.105.73
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1405580932.A.9E4.html
1F:→ tnek:自问自答:只要在ToString()前面加上 .Value 就好了... 07/17 16:04
2F:推 J002:那个栏位应该是Nullable的栏位? 07/17 21:38