从另一个胜利表格中拨打一个胜利表格

时间:2011-04-28 21:11:17

标签: winforms visual-c++

我有两个使用托管C ++构建的win表单。按下一个按钮,应该从Client.h打开另一个表单(login.h),但是我收到的错误如“错误C3673:'SenderApp :: Login':类没有复制构造函数”。

以下是login.h代码:

#pragma once

namespace SenderApp {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    /// <summary>
    /// Summary for Login
    /// </summary>
    public ref class Login : public System::Windows::Forms::Form
    {
    public:
        Login(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }

    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~Login()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Label^  label1;
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::TextBox^  textBox2;
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::Label^  label4;
    protected: 

    private:
        /// <summary>
        /// Required designer variable.
        /// </summary>
        System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->label4 = (gcnew System::Windows::Forms::Label());
            this->SuspendLayout();
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Location = System::Drawing::Point(12, 111);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(60, 13);
            this->label1->TabIndex = 0;
            this->label1->Text = L"User Name";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Location = System::Drawing::Point(136, 21);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(58, 13);
            this->label2->TabIndex = 1;
            this->label2->Text = L"User Login";
            this->label2->Click += gcnew System::EventHandler(this, &Login::label2_Click);
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Location = System::Drawing::Point(12, 157);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(53, 13);
            this->label3->TabIndex = 2;
            this->label3->Text = L"Password";
            this->label3->Click += gcnew System::EventHandler(this, &Login::label3_Click);
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(91, 108);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(181, 20);
            this->textBox1->TabIndex = 3;
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(91, 154);
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(181, 20);
            this->textBox2->TabIndex = 4;
            this->textBox2->TextChanged += gcnew System::EventHandler(this, &Login::textBox2_TextChanged);
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(63, 212);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(75, 23);
            this->button1->TabIndex = 5;
            this->button1->Text = L"Submit";
            this->button1->UseVisualStyleBackColor = true;
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(197, 212);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(75, 23);
            this->button2->TabIndex = 6;
            this->button2->Text = L"Cancel";
            this->button2->UseVisualStyleBackColor = true;
            // 
            // label4
            // 
            this->label4->AutoSize = true;
            this->label4->Location = System::Drawing::Point(12, 59);
            this->label4->Name = L"label4";
            this->label4->Size = System::Drawing::Size(303, 13);
            this->label4->TabIndex = 7;
            this->label4->Text = L"[Please use the pre-defined logins in login.xml at C:\\Repository]";
            this->label4->Click += gcnew System::EventHandler(this, &Login::label4_Click);
            // 
            // Login
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(339, 267);
            this->Controls->Add(this->label4);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->label3);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->Name = L"Login";
            this->Text = L"Login";
            this->ResumeLayout(false);
            this->PerformLayout();

        }
#pragma endregion
    private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void label3_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void textBox2_TextChanged(System::Object^  sender, System::EventArgs^  e) {
             }
private: System::Void label4_Click(System::Object^  sender, System::EventArgs^  e) {
         }
};
}

我试过像Login lgn = gcnew Login();

这样的东西

1 个答案:

答案 0 :(得分:2)

我知道这个问题真的很老了,但是我发现它有同样的问题并没有帮助,所以当我找到我的解决方案时,我想我应该发布它......

您不必实现复制构造函数,只需使用指针,即 -

Login^ lgn = gcnew Login();
lgn->Show();