C ා programming encountered an object reference is required for the non-static field, method, or property error

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: