CS0120: An object reference is required for the nonstatic field, method, or property 'foo'

前端 未结 7 1084
挽巷
挽巷 2020-11-21 04:34

Consider:

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            


        
7条回答
  •  臣服心动
    2020-11-21 05:23

    Your method must be static

    static void setTextboxText(int result)
    {
        if (this.InvokeRequired)
        {
            this.Invoke(new IntDelegate(SetTextboxTextSafe), new object[] { result }); 
        }
        else
        {
            SetTextboxTextSafe(result);
        }
    }
    

提交回复
热议问题