如何正确比较? [英] How make correctly comparison?
本文介绍了如何正确比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在循环中,我得到datagridview的所有行,并获得一个名为Ststus的字段。这个字段包含字符串数据0或1
当我检查时:
In loop i get all rows of datagridview and get value one field with name Ststus. This fields contains string data "0" or "1"
When i do check:
foreach (DataGridViewRow item in ListCards.Rows)
{
if (item.Cells["Status"].Value == "1")
{
}
}
即使在item.Cells [状态],工作总是假的我的条件有值= 1
我做错了什么?
My condition if works always false even if at item.Cells["Status"] there is value = 1
What i do wrong?
推荐答案
foreach (DataGridViewRow item in ListCards.Rows)
{
if (item.SelectedCells["Status"].Value.ToString() == "1")
{
}
}
这篇关于如何正确比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文