When you create static methods in your form code, the source code looks like this
public int imageNum=0;
。。。。。。
public static int button1_clicknum()
{
return imageNum;
}
This is followed by an error such as the following. The error is caused by the fact that the static method cannot directly access the non-static member, and the non-static field needs to be referenced, which can be a private member of an instance. To correct this, change imagenum to a static member.
Public static int imageNum = 0;
Read More:
- Property or field ‘Title‘ cannot be found on object of type
- Failed to import static file of vue3 static resource. There is no static folder
- [Qt] error: call to non-static member function without an object argument
- C# Member XXX cannot be accessed with an instance with an instance reference;qualify it with a type
- SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
- [Solved] error: Microsoft Visual C++ 14.0 or greater is required
- SSM project controller layer calls static method to report an error
- non-static variable this cannot be referenced from a static context
- Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools“
- ‘builtin_ function_ or_ Method ‘object is not subscriptable error
- HTML method IE8 reports an error, IE8 jQuery Ajax obtains static resources reports an error, typeerror denies access
- Spock + powermock simulation static method reports an error java.lang.classcastexception
- The background object of thymeleaf is null, which solves the problem of error when the object is empty to get the property value
- Python error prompt: typeerror: ‘builtin’_ function_ or_ method‘ object is not subscriptable
- Error: java.lang.IllegalArgumentExcept :Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
- Springboot error: property ‘sqlsessionfactory’ or ‘sqlsessiontemplate’ are required error details
- When the mybatis field contains an expression, an error is reported when it is stored in the database
- Use xx [‘xx ‘] = XX to set field value or does not support field: XXX
- Vue uses this. $refs. Subcomponent Ref. method to report an error: cannot read property ‘resetfields’ of undefined problem
- TypeError: object of type ‘builtin_function_or_method’ has no len()