两个小问题求解,两个小问题求解,两个小问题求解

goodluck20131313 2011-07-23 12:22:53
(一)在WINFORM中,为什么计算的合计结果不对,代码如下
for (int i = 0; i < dv_grid.Rows.Count - 1; i++)
{
string id = this.dv_grid[0, i].Value.ToString();
if (id != "")
{
amount = amount + Convert.ToDecimal(this.dv_grid.Rows[i].Cells["pro_amount"].Value.ToString());
price = price + Convert.ToDecimal(this.dv_grid.Rows[i].Cells["pro_price"].Value.ToString()); }
}
(二)
for (int s = 0; s < dv_grid.Rows.Count - 1; s++)
{

if (this.dv_grid[0, s].Value.ToString() != "")
{
proname = this.dv_grid[1, s].Value.ToString(); //这里如何写才正确?
MessageBox.Show(proname);
}
...全文
74 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yixian2007 2011-07-23
  • 打赏
  • 举报
回复
试试formattedvalue
bdmh 2011-07-23
  • 打赏
  • 举报
回复
什么玩意,谁知到你在说什么

110,546

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧