| | |
How to link Buttons in C++.NET?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I need to link the "Button1" from "Form1" to "Form2"
Form1:
Form2:
Form1:
•
•
•
•
#pragma once
namespace Botz0004 {
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::Label^ label1;
private: System::Windows::Forms::MaskedTextBox^ maskedTextBox1;
private: System::Windows::Forms::Button^ button1;
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->maskedTextBox1 = (gcnew System::Windows::Forms::MaskedTextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(73, 59);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(147, 16);
this->label1->TabIndex = 0;
this->label1->Text = L"What is your name\? ";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// maskedTextBox1
//
this->maskedTextBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->maskedTextBox1->Location = System::Drawing::Point(30, 127);
this->maskedTextBox1->Name = L"maskedTextBox1";
this->maskedTextBox1->Size = System::Drawing::Size(233, 20);
this->maskedTextBox1->TabIndex = 1;
this->maskedTextBox1->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
//
// button1
//
this->button1->Location = System::Drawing::Point(105, 179);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(84, 23);
this->button1->TabIndex = 2;
this->button1->Text = L"Next";
this->button1->UseVisualStyleBackColor = true;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 270);
this->Controls->Add(this->button1);
this->Controls->Add(this->maskedTextBox1);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Botz0004";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
};
}
Form2:
•
•
•
•
#pragmaonce
namespace Botz0004 {
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::Label^ label1;
private: System::Windows::Forms::MaskedTextBox^ maskedTextBox1;
private: System::Windows::Forms::Button^ button1;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragmaregion 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->maskedTextBox1 = (gcnew System::Windows::Forms::MaskedTextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(73, 59);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(147, 16);
this->label1->TabIndex = 0;
this->label1->Text = L"What is your name\? ";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// maskedTextBox1
//
this->maskedTextBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->maskedTextBox1->Location = System::Drawing::Point(30, 127);
this->maskedTextBox1->Name = L"maskedTextBox1";
this->maskedTextBox1->Size = System::Drawing::Size(233, 20);
this->maskedTextBox1->TabIndex = 1;
this->maskedTextBox1->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
//
// button1
//
this->button1->Location = System::Drawing::Point(105, 179);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(84, 23);
this->button1->TabIndex = 2;
this->button1->Text = L"Next";
this->button1->UseVisualStyleBackColor = true;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 270);
this->Controls->Add(this->button1);
this->Controls->Add(this->maskedTextBox1);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Botz0004";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragmaendregion
};
}
Last edited by ongxizhe; Jun 11th, 2007 at 11:11 am.
![]() |
Similar Threads
- Web Directory Web Stats Link exchange (Relevant Link Exchanges)
- How To Hyperlink Normal HTML page with ASP.NET Page? (ASP.NET)
- 2 PR6 Sites Link Exchange (Relevant Link Exchanges)
- create an app drag & drop controls in asp.net (ASP.NET)
- How can i change a picture navigation link after succesfuuly logging in. (ASP.NET)
Other Threads in the C++ Forum
- Previous Thread: C++ Variable help
- Next Thread: Where to get good C++ GUI tutorials?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






