TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Robert Armenski
NA
1
0
Output from 2 text boxes is summed in the third
Jan 30 2009 9:53 AM
OK, so I have a Windows Forms Application in C++. It has 3 forms. In Form2.h i have 3 textboxes . I want you to give me the command (and where to put it) , so that when I enter values in the 1st and 2nd texbox, they are summed in the 3rd textbox
Here is my code for the Form2.h ... please edit it and place a right command on the right place, so my idea will work . (P.S. I've read a question simmilar like this here, but it didn't help me).
Code:
-------------------------------------------------------------------------------------
#pragma once
#include <cstdlib>
#include <iostream>
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;
namespace AreaCalcwithGUIBETA {
/// <summary>
/// Summary for Form2
///
/// 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 Form2 : public System::Windows::Forms::Form
{
public:
Form2(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form2()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::PictureBox^ pictureBox1;
protected:
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::TextBox^ textBox4;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::Button^ button1;
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)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form2::typeid));
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->SuspendLayout();
//
// pictureBox1
//
this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));
this->pictureBox1->Location = System::Drawing::Point(12, 12);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(204, 111);
this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::Zoom;
this->pictureBox1->TabIndex = 0;
this->pictureBox1->TabStop = false;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(22, 140);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(86, 13);
this->label1->TabIndex = 1;
this->label1->Text = L"Value for side a :";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(22, 240);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(57, 13);
this->label2->TabIndex = 2;
this->label2->Text = L"Perimeter :";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(22, 278);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(35, 13);
this->label3->TabIndex = 3;
this->label3->Text = L"Area :";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(222, 52);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(86, 13);
this->label4->TabIndex = 4;
this->label4->Text = L"Value for side b :";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(114, 140);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(86, 20);
this->textBox1->TabIndex = 5;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(100, 237);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(100, 20);
this->textBox2->TabIndex = 6;
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(79, 275);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(121, 20);
this->textBox3->TabIndex = 7;
this->textBox3->TextChanged += gcnew System::EventHandler(this, &Form2::textBox3_TextChanged);
//
// textBox4
//
this->textBox4->Location = System::Drawing::Point(225, 78);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(100, 20);
this->textBox4->TabIndex = 8;
//
// label5
//
this->label5->AutoSize = true;
this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.5F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label5->Location = System::Drawing::Point(222, 240);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(68, 15);
this->label5->TabIndex = 9;
this->label5->Text = L"L = 2a + 2b";
//
// label6
//
this->label6->AutoSize = true;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.5F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label6->Location = System::Drawing::Point(222, 278);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(53, 15);
this->label6->TabIndex = 10;
this->label6->Text = L"P = a * b";
//
// button1
//
this->button1->Location = System::Drawing::Point(349, 280);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(65, 26);
this->button1->TabIndex = 11;
this->button1->Text = L"Exit";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form2::button1_Click);
//
// Form2
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->AutoSize = true;
this->ClientSize = System::Drawing::Size(430, 318);
this->Controls->Add(this->button1);
this->Controls->Add(this->label6);
this->Controls->Add(this->label5);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->pictureBox1);
this->MaximizeBox = false;
this->Name = L"Form2";
this->ShowIcon = false;
this->Text = L"Rectangle";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form2::Close();
}
private: System::Void textBox3_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
};
}
-----------------------------------------------------------------------------------
I've tried something around, but it didn't work ... :( please help me...
THANKS IN ADVANCE.
Reply
Answers (
0
)
9th BME International 24-hour Programming Contest
Difference between Interface ID and Object ID