如果行单元格具有此值(D),并且没有行具有像这样的单元格值,则需要搜索datagridview。这是我的代码,但它的错误如何检查datagridview是否返回具有特定值的0行
ID Qty Price D
==================
1 5 2.00 D
2 4 3.00
3 2 10.00 D
这就是我的代码datagridview的示例。
private void noD()
{
foreach (DataGridViewRow row in dgvPOScart.Rows)
{
if (Convert.ToChar(row.Cells[3].Value) != 'D')
{
// If no rows withcell[3] having a value of D
// (For example only item is with ID 2)
//Do this
}
}
}
您的索引称其为6?例如reeplace row.Cells [3]。值 – CMedina
是的,我的实际索引是6位右边我将它更改为3,例如ty – FutureDev
只需使用布尔标志变量,如果您发现你的专栏中有一个“D”。 *在循环*之后,如果该标记为假,则没有折扣。如果这是真的,那么你确实有打折项目。 – LarsTech