c ++ / clr获取子表单的数据

时间:2015-06-26 12:53:12

标签: winforms c++-cli clr

Form1中的

public: System::Windows::Forms::Label^  TUserName;
Form2中的

public: System::Windows::Forms::Label^  OutTex;

在Form2中单击按钮B1

private: System::Void B1_Click(System::Object^  sender, System::EventArgs^  e) {
    Form1^ RunC = gcnew Form1;

    OutTex->Text = RunC->TUserName->Text;
}

编译错误

Error   1   error C2065: 'Form1' : undeclared identifier    d:\Project\Form2.h  1030    1   Project1
Error   2   error C2065: 'RunC' : undeclared identifier d:\Project\Form2.h  1030    1   Project1
Error   3   error C2061: syntax error : identifier 'Form1'  d:\Project\Form2.h  1030    1   Project1
Error   4   error C2065: 'RunC' : undeclared identifier d:\Project\Form2.h  1032    1   Project1
Error   5   error C2227: left of '->TUserName' must point to class/struct/union/generic type    d:\Project\Form2.h  1032    1   Project1
Error   6   error C2227: left of '->Text' must point to class/struct/union/generic type d:\Project\Form2.h  1032    1   Project1

请帮我解决这个问题

0 个答案:

没有答案