在表单C ++ CLR之间传递数组

时间:2017-05-13 14:24:52

标签: winforms visual-studio c++-cli

我想在以下函数中将生成的数组(arNum [20])从表单编号1(MyForm.h)传递到表单编号2(MyForm1.h)

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    int x;
    int arNum[20];
    if (!int::TryParse(txtNodes->Text, x)) 
        MessageBox::Show("First box wasn't an integer");

    else
    {
        for (int i = 0; i < txtNumbers->Text->Length; i+=2)
        {
            if (!(int)txtNumbers->Text[i])
            {
                MessageBox::Show("Invalid Input!");
                return;
            }
            else
            {
                arNum[i] = (int)txtNumbers->Text[i];
            }
        }
        MessageBox::Show("Data submitted correctly.");
        MyForm1 ^form = gcnew MyForm1();
        form->
    }


}

感谢。

0 个答案:

没有答案