运算符'>'不能应用于类型为“方法组"和“整数"的操作数 [英] Operator '>' cannot be applied to operands of type 'method group' and 'int'
本文介绍了运算符'>'不能应用于类型为“方法组"和“整数"的操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此代码:
for (int i = 0; i < ListView2.Items.Count; i++)
{
if (((CheckBox)ListView2.Items[i].FindControl("UcastCheckBox")).Checked || ((TextBox)ListView2.Items[i].FindControl("BrankyTextBox")).ToString > 0)
{
}
}
但是现在取消选中所有复选框...:/
But now unchecked all checkboxs...:/
你能解决这个问题吗?
推荐答案
您必须将字符串强制转换为int值.
You have to cast the string to int value.
for (int i = 0; i < ListView2.Items.Count; i++)
{
int a;
Int32.TryParse(((TextBox)ListView2.Items[i].FindControl("BrankyTextBox")).ToString(), out a);
if (((CheckBox)ListView2.Items[i].FindControl("UcastCheckBox")).Checked ||
a > 0)
{
}
}
这篇关于运算符'>'不能应用于类型为“方法组"和“整数"的操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文