Me comunico para consultarles lo siguiente:
Estoy Trabajando en un Proyecto de winform en C++
Quiero un "Hola Mundo" al apretar un Botón, que aparezca en un Label o MessageShowBox...
Ese es el codigo;
Código
#pragma once namespace Cualquiera { 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> /// Resumen de Form1 /// /// ADVERTENCIA: si cambia el nombre de esta clase, deberá cambiar la /// propiedad 'Nombre de archivos de recursos' de la herramienta de compilación de recursos administrados /// asociada con todos los archivos .resx de los que depende esta clase. De lo contrario, /// los diseñadores no podrán interactuar correctamente con los /// recursos adaptados asociados con este formulario. /// </summary> public ref class Form1 : public System::Windows::Forms::Form; { public: Form1(void) { InitializeComponent(); // //TODO: agregar código de constructor aquí // } protected: /// <summary> /// Limpiar los recursos que se estén utilizando. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ Guardar1; protected: protected: private: System::Windows::Forms::TextBox^ textBox1; private: System::Windows::Forms::Label^ label1; private: /// <summary> /// Variable del diseñador requerida. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Método necesario para admitir el Diseñador. No se puede modificar /// el contenido del método con el editor de código. /// </summary> void InitializeComponent(void) { this->Guardar1 = (gcnew System::Windows::Forms::Button()); this->textBox1 = (gcnew System::Windows::Forms::TextBox()); this->label1 = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); // // Guardar1 // this->Guardar1->BackColor = System::Drawing::SystemColors::ActiveCaption; this->Guardar1->ForeColor = System::Drawing::SystemColors::HotTrack; this->Guardar1->Location = System::Drawing::Point(102, 145); this->Guardar1->Name = L"Guardar1"; this->Guardar1->Size = System::Drawing::Size(75, 23); this->Guardar1->TabIndex = 0; this->Guardar1->Text = L"Guardar"; this->Guardar1->UseVisualStyleBackColor = false; this->Guardar1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // textBox1 // this->textBox1->Location = System::Drawing::Point(91, 55); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(100, 20); this->textBox1->TabIndex = 1; this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(284, 262); this->Controls->Add(this->label1); this->Controls->Add(this->textBox1); this->Controls->Add(this->Guardar1); this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); this->PerformLayout(); } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { label1.Text = "Hola Mundo"; } private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) { } }
Me tira estos 3 Errores, como muestra lo que les adjunto...
Código:
Error C2143: error de sintaxis: falta"," delante de ";"
Error C2143: error de sintaxis: falta";" delante de 'using'
Error C2228: el operando izquierdo de ".Text" debe tener class/sruct/union (es un Label)
Sabrían resolver ese entuerto??
Desde ya, les agradezco cualquier ayuda......
MOD: El código debe ir entre etiquetas de Código GeSHi