I keep getting the following errors in my program:
\'System.Windows.Forms.TextBox.Text\' is a \'property\' but used like a \'method\'
and>
It have happened because you are trying to use the property "OffenceBox.Text" like a method. Try to remove parenteses from OffenceBox.Text() and it'll work fine.
Remember that you cannot create a method and a property with the same name in a class.
By the way, some alias could confuse you, since sometimes it's method or property, e.g: "Count" alias:
Namespace: System.Linq
using System.Linq
namespace Teste
{
public class TestLinq
{
public return Foo()
{
var listX = new List();
return listX.Count(x => x.Id == 1);
}
}
}
Namespace: System.Collections.Generic
using System.Collections.Generic
namespace Teste
{
public class TestList
{
public int Foo()
{
var listX = new List();
return listX.Count;
}
}
}