输入格式不正确 [英] input was not in correct format

查看:81
本文介绍了输入格式不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int sum = 0;

for (int i = 0; i < dataGridView1.Rows.Count; ++i)

{
               
 sum += Convert.ToInt32(dataGridView1.Rows[i].Cells[38].Value);
            
}
            
txt_balance.Text = sum.ToString();
            
txt_total.Text = sum.ToString();
            
txt_Exempt.Text = sum.ToString();





我遇到错误输入字符串不是格式正确。如果datagridview行增加,我想计算列值。我尝试了,当我执行这个错误时



请指导...



am having a error like Input string is not in correct format. i want calcuate the column values if datagridview row is incremented. i tried when i execute this am getting error

pls guide...

推荐答案

在你的某个地方loop dataGridView1.Rows [i] .Cells [38] .Value 具有无效的整数值(作为字符串)。我建议你调试你的应用程序以找到问题。
somewhere during your loop dataGridView1.Rows[i].Cells[38].Value has invalid integer value (as string). I suggest you debug your application to find the probelm.


sum值包含特殊字符......这就是为什么它显示'是错误
the sum value contains special character... that why it show''s the error


这篇关于输入格式不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆