C#报错:Object reference not set to an instance of an object,在另一个窗体调用主窗体的函数时候,报错了,如下图所示
经过排查,将代码修改如下即可。需要加上form1 = this;
public static Form1 form1; public Form1() { InitializeComponent(); form1 = this; }
C#报错:Object reference not set to an instance of an object,在另一个窗体调用主窗体的函数时候,报错了,如下图所示
经过排查,将代码修改如下即可。需要加上form1 = this;
public static Form1 form1; public Form1() { InitializeComponent(); form1 = this; }