Hello
I have created a winform with 2 textboxes. I need to read the data from first textbox as a string and then pass this data to another textbox as a string. How can I do it?
Here is the code of .h file
Code:
#pragma once
namespace Forma {
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>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//
}
protected:
/// <summary>
///
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ num1;
private: System::Windows::Forms::TextBox^ num2;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::ComponentModel::IContainer^ components;
protected:
private:
/// <summary>
///
/// </summary>
#pragma region Windows Form Designer generated code
/// <summary>
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->num1 = (gcnew System::Windows::Forms::TextBox());
this->num2 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(101, 216);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(107, 41);
this->button1->TabIndex = 0;
this->button1->Text = L"start";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(98, 9);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(81, 13);
this->label1->TabIndex = 1;
this->label1->Text = L"Simple Example";
this->label1->Click += gcnew System::EventHandler(this, &MyForm::label1_Click);
//
// num1
//
this->num1->Location = System::Drawing::Point(101, 68);
this->num1->Name = L"num1";
this->num1->Size = System::Drawing::Size(141, 20);
this->num1->TabIndex = 2;
this->num1->TextChanged += gcnew System::EventHandler(this, &MyForm::textBox1_TextChanged);
//
// num2
//
this->num2->Location = System::Drawing::Point(65, 130);
this->num2->Name = L"num2";
this->num2->Size = System::Drawing::Size(177, 20);
this->num2->TabIndex = 3;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(22, 71);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(54, 13);
this->label2->TabIndex = 4;
this->label2->Text = L"input data";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(22, 133);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(41, 13);
this->label3->TabIndex = 5;
this->label3->Text = L"answer";
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(311, 284);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->num2);
this->Controls->Add(this->num1);
this->Controls->Add(this->label1);
this->Controls->Add(this->button1);
this->MaximizeBox = false;
this->Name = L"MyForm";
this->Text = L"Myform";
this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
};
}