
como volver a un formulario en visual c++
Publicado por andres (3 intervenciones) el 19/07/2014 03:08:03
buenas tardes tengo una gran inquietud, hace poco me cambie a la plataforma de programación multilenguaje que ofrece visual estudio; especial mente utilizo visual c++.
el problema es el siguiente
creo un programa en cual tiene un MyForm "primera form" en el cual coloco un boton,
despues agrego al proyecto un nuevo formulario "MyForm1", "es el segundo form" el cual va hacer llamado "mostrado" cuando el evento click del boton de la MyForm sea ejecutado
asta hay todo va bien,
el problema es cuando quiero que MyForm1 "la segunda form" por medio de un boton me muestre MyForm "primera form" ........
ese es realmente el problema, me gustaría que me echaran una manito ya que llevo mas de un mes divagando en la web sin encontrar solución actual mente estoy trabajando con visual c++ 2013
agrego el bloque de codigo el cual esta descrito lo que llevo
esta es Myform "el primer formulario"
#pragma once
#include"MyForm1.h"
namespace Project1 {
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 MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: agregar código de constructor aquí
//
}
protected:
/// <summary>
/// Limpiar los recursos que se estén utilizando.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
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->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(30, 45);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(280, 258);
this->Controls->Add(this->button1);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MyForm1().ShowDialog();
}
};
}
esta es MyForm1 "la segunda form"
#pragma once
#include"MyForm.h"
namespace Project1 {
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 MyForm1
/// </summary>
public ref class MyForm1 : public System::Windows::Forms::Form
{
public:
MyForm1(void)
{
InitializeComponent();
//
//TODO: agregar código de constructor aquí
//
}
protected:
/// <summary>
/// Limpiar los recursos que se estén utilizando.
/// </summary>
~MyForm1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
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->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(12, 33);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm1::button1_Click);
//
// MyForm1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(280, 258);
this->Controls->Add(this->button1);
this->Name = L"MyForm1";
this->Text = L"MyForm1";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MyForm().ShowDialog();
}
};
}
el problema es el siguiente
creo un programa en cual tiene un MyForm "primera form" en el cual coloco un boton,
despues agrego al proyecto un nuevo formulario "MyForm1", "es el segundo form" el cual va hacer llamado "mostrado" cuando el evento click del boton de la MyForm sea ejecutado
asta hay todo va bien,
el problema es cuando quiero que MyForm1 "la segunda form" por medio de un boton me muestre MyForm "primera form" ........
ese es realmente el problema, me gustaría que me echaran una manito ya que llevo mas de un mes divagando en la web sin encontrar solución actual mente estoy trabajando con visual c++ 2013
agrego el bloque de codigo el cual esta descrito lo que llevo
esta es Myform "el primer formulario"
#pragma once
#include"MyForm1.h"
namespace Project1 {
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 MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: agregar código de constructor aquí
//
}
protected:
/// <summary>
/// Limpiar los recursos que se estén utilizando.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
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->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(30, 45);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(280, 258);
this->Controls->Add(this->button1);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MyForm1().ShowDialog();
}
};
}
esta es MyForm1 "la segunda form"
#pragma once
#include"MyForm.h"
namespace Project1 {
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 MyForm1
/// </summary>
public ref class MyForm1 : public System::Windows::Forms::Form
{
public:
MyForm1(void)
{
InitializeComponent();
//
//TODO: agregar código de constructor aquí
//
}
protected:
/// <summary>
/// Limpiar los recursos que se estén utilizando.
/// </summary>
~MyForm1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
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->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(12, 33);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm1::button1_Click);
//
// MyForm1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(280, 258);
this->Controls->Add(this->button1);
this->Name = L"MyForm1";
this->Text = L"MyForm1";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MyForm().ShowDialog();
}
};
}
Valora esta pregunta


0