且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将datagridview列值与文本框值相乘。

更新时间:2023-02-20 15:59:21

如果GridView中没有行,则sum将为零。你需要添加一个正确的行数检查,如果没有,则采取不同的行动。



另外......

If there are no rows in the GridView then sum will be zero. You need to add a proper check for the number of rows and take a different action if there are none.

Also ...
        totPenTxt.Text = Convert.ToInt32(0).ToString();
// why not just:
        totPenTxt.Text = "0";