非话语会员不能像方法一样使用吗? [英] Non-invocable member cannot be used like a method?
本文介绍了非话语会员不能像方法一样使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的程序中不断出现以下错误:
I keep getting the following errors in my program:
'System.Windows.Forms.TextBox.Text' is a 'property' but used like a 'method'
和
Non-invocable member 'System.Windows.Forms.Control.Text' cannot be used like a method.
这是代码:
if (OffenceBox.Text != "")
{
AddBook(int.Parse(AgeBox.Text), NameBox.Text, AddressBox.Text, (HeightBox.Text), OffenceBox.Text());
}
else
{
MessageBox.Show("Age must be max 3 numbers in length");
}
}
如何解决此问题?
修复了错误,现在遇到了另一个错误:参数4:无法将String转换为int
,我似乎无法解决问题.
Fixed the error and now encountered another:
Argument 4: Cannot convert String to int
and I can't seem to fix the problem.
推荐答案
在编写"OffenceBox.Text()"的地方,需要将其替换为"OffenceBox.Text".这是属性,而不是方法-线索出在错误中!
Where you've written "OffenceBox.Text()", you need to replace this with "OffenceBox.Text". It's a property, not a method - the clue's in the error!
这篇关于非话语会员不能像方法一样使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文