Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
语法错误:缺少'';在';之前'; 我不熟悉VisualC++,所以我用.NETFramework编译了一个简单的程序来寻找它的方式。 #pragma once namespace Netattempt2 { 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 Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::TextBox^ txtbxUsername; private: System::Windows::Forms::Button^ btnClick; protected: protected: private: System::Windows::Forms::Label^ label1; 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->txtbxUsername = (gcnew System::Windows::Forms::TextBox()); this->btnClick = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); // // txtbxUsername // this->txtbxUsername->Location = System::Drawing::Point(94, 17); this->txtbxUsername->Name = L"txtbxUsername"; this->txtbxUsername->Size = System::Drawing::Size(174, 20); this->txtbxUsername->TabIndex = 0; // // btnClick // this->btnClick->Location = System::Drawing::Point(204, 43); this->btnClick->Name = L"btnClick"; this->btnClick->Size = System::Drawing::Size(64, 23); this->btnClick->TabIndex = 1; this->btnClick->Text = L"Click Me!"; this->btnClick->UseVisualStyleBackColor = true; this->btnClick->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(12, 20); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(76, 13); this->label1->TabIndex = 2; this->label1->Text = L"Enter name -->"; this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(284, 73); this->Controls->Add(this->label1); this->Controls->Add(this->btnClick); this->Controls->Add(this->txtbxUsername); this->Name = L"Form1"; this->Text = L"Hello World!"; this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void btnClick_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox.Show("Welcome to windows " + txtbxUsername.Text, "Hi there..."); } }; }_.net_Visual Studio_C++ Cli - Fatal编程技术网

语法错误:缺少'';在';之前'; 我不熟悉VisualC++,所以我用.NETFramework编译了一个简单的程序来寻找它的方式。 #pragma once namespace Netattempt2 { 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 Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::TextBox^ txtbxUsername; private: System::Windows::Forms::Button^ btnClick; protected: protected: private: System::Windows::Forms::Label^ label1; 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->txtbxUsername = (gcnew System::Windows::Forms::TextBox()); this->btnClick = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); // // txtbxUsername // this->txtbxUsername->Location = System::Drawing::Point(94, 17); this->txtbxUsername->Name = L"txtbxUsername"; this->txtbxUsername->Size = System::Drawing::Size(174, 20); this->txtbxUsername->TabIndex = 0; // // btnClick // this->btnClick->Location = System::Drawing::Point(204, 43); this->btnClick->Name = L"btnClick"; this->btnClick->Size = System::Drawing::Size(64, 23); this->btnClick->TabIndex = 1; this->btnClick->Text = L"Click Me!"; this->btnClick->UseVisualStyleBackColor = true; this->btnClick->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(12, 20); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(76, 13); this->label1->TabIndex = 2; this->label1->Text = L"Enter name -->"; this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(284, 73); this->Controls->Add(this->label1); this->Controls->Add(this->btnClick); this->Controls->Add(this->txtbxUsername); this->Name = L"Form1"; this->Text = L"Hello World!"; this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void btnClick_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox.Show("Welcome to windows " + txtbxUsername.Text, "Hi there..."); } }; }

语法错误:缺少'';在';之前'; 我不熟悉VisualC++,所以我用.NETFramework编译了一个简单的程序来寻找它的方式。 #pragma once namespace Netattempt2 { 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 Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::TextBox^ txtbxUsername; private: System::Windows::Forms::Button^ btnClick; protected: protected: private: System::Windows::Forms::Label^ label1; 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->txtbxUsername = (gcnew System::Windows::Forms::TextBox()); this->btnClick = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); // // txtbxUsername // this->txtbxUsername->Location = System::Drawing::Point(94, 17); this->txtbxUsername->Name = L"txtbxUsername"; this->txtbxUsername->Size = System::Drawing::Size(174, 20); this->txtbxUsername->TabIndex = 0; // // btnClick // this->btnClick->Location = System::Drawing::Point(204, 43); this->btnClick->Name = L"btnClick"; this->btnClick->Size = System::Drawing::Size(64, 23); this->btnClick->TabIndex = 1; this->btnClick->Text = L"Click Me!"; this->btnClick->UseVisualStyleBackColor = true; this->btnClick->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(12, 20); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(76, 13); this->label1->TabIndex = 2; this->label1->Text = L"Enter name -->"; this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(284, 73); this->Controls->Add(this->label1); this->Controls->Add(this->btnClick); this->Controls->Add(this->txtbxUsername); this->Name = L"Form1"; this->Text = L"Hello World!"; this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void btnClick_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox.Show("Welcome to windows " + txtbxUsername.Text, "Hi there..."); } }; },.net,visual-studio,c++-cli,.net,Visual Studio,C++ Cli,返回此错误: Form1.h(114) : error C2143: syntax error : missing ';' before '.' 取出该行允许程序编译,但消息框对程序来说或多或少是必要的 有人知道这里出了什么问题吗?换成 MessageBox::Show("Welcome to windows " + txtbxUsername->Text, "Hi there..."); ^^

返回此错误:

Form1.h(114) : error C2143: syntax error : missing ';' before '.'
取出该行允许程序编译,但消息框对程序来说或多或少是必要的

有人知道这里出了什么问题吗?

换成

MessageBox::Show("Welcome to windows " + txtbxUsername->Text, "Hi there..."); 
          ^^                                          ^^
改为

MessageBox::Show("Welcome to windows " + txtbxUsername->Text, "Hi there..."); 
          ^^                                          ^^

请注意,这不是C++:这是C++/CLI。请注意,这不是C++:这是C++/CLI。
txtbxUsername。我想,文本
也需要是
txtbxUsername->Text
。@JamesMcNellis,是的,谢谢,我的眼睛有点累,一开始就停下来了。我想该睡觉了。谢谢。这一切都解决了。我想找出C++和C语法之间的一些差异,我想。“代码> TXTBXUSENREST。文本< /代码>还需要是代码> TXTBXUSENARTENS >文本< /代码>,我想。@ JamesMcNellis,是的,谢谢。我的眼睛有点累,停在第一位。我想该睡觉了。谢谢。这一切都解决了。我想找出C++与C语法之间的一些差异,我想我已经知道了。