我应该在哪里声明我喜欢在 Windows 窗体中使用的变量?
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
int iMyvariable = 1;
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
iMyvariable++;
}
运行代码会出现以下错误:
错误 C2065:“iMyvariable”:未声明的标识符