Đăng Nhập

Vui lòng khai báo chính xác tên truy cập và mật khẩu!

Quên mật khẩu?

    Nhập xuất trên Windows Forms c++

      Admin
      Admin

      Giới tính : Nam

      Đến từ : TPHCM

      Ngày Tham gia : 03/04/2011

      Tổng số bài gửi : 2292

      #1

       Wed Jul 18, 2012 7:14 pm

      Nhập xuất  trên  Windows Forms c++ C10


      code
      Code:
      #pragma once
      #include <string>
      #include <iostream>

      namespace chan {

         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
               //
               

            }
         private: System::Windows::Forms::TextBox^  tb2;
         public:

         public:
            String^ text;
         protected:
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            ~Form1()
            {
               if (components)
               {
                  delete components;
               }
            }
         private: System::Windows::Forms::Button^  xuat;
         protected:
         private: System::Windows::Forms::TextBox^  tb;
         private: System::Windows::Forms::Label^  thongbao;
         private: System::Windows::Forms::Button^  button1;
         private: System::Windows::Forms::Button^  button2;

         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->xuat = (gcnew System::Windows::Forms::Button());
               this->tb = (gcnew System::Windows::Forms::TextBox());
               this->thongbao = (gcnew System::Windows::Forms::Label());
               this->button1 = (gcnew System::Windows::Forms::Button());
               this->button2 = (gcnew System::Windows::Forms::Button());
               this->tb2 = (gcnew System::Windows::Forms::TextBox());
               this->SuspendLayout();
               //
               // xuat
               //
               this->xuat->Location = System::Drawing::Point(12, 182);
               this->xuat->Name = L"xuat";
               this->xuat->Size = System::Drawing::Size(106, 51);
               this->xuat->TabIndex = 0;
               this->xuat->Text = L"Xuất ra";
               this->xuat->UseVisualStyleBackColor = true;
               this->xuat->Click += gcnew System::EventHandler(this, &Form1::xuat_Click);
               //
               // tb
               //
               this->tb->Location = System::Drawing::Point(21, 12);
               this->tb->Multiline = true;
               this->tb->Name = L"tb";
               this->tb->Size = System::Drawing::Size(251, 52);
               this->tb->TabIndex = 1;
               this->tb->Text = L"Nhập chữ vào!!!";
               //
               // thongbao
               //
               this->thongbao->AutoSize = true;
               this->thongbao->ForeColor = System::Drawing::Color::Red;
               this->thongbao->Location = System::Drawing::Point(18, 82);
               this->thongbao->Name = L"thongbao";
               this->thongbao->Size = System::Drawing::Size(0, 13);
               this->thongbao->TabIndex = 2;
               //
               // button1
               //
               this->button1->Location = System::Drawing::Point(191, 182);
               this->button1->Name = L"button1";
               this->button1->Size = System::Drawing::Size(72, 108);
               this->button1->TabIndex = 3;
               this->button1->Text = L"Thoát";
               this->button1->UseVisualStyleBackColor = true;
               this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
               //
               // button2
               //
               this->button2->Location = System::Drawing::Point(12, 246);
               this->button2->Name = L"button2";
               this->button2->Size = System::Drawing::Size(106, 44);
               this->button2->TabIndex = 4;
               this->button2->Text = L"Xóa";
               this->button2->UseVisualStyleBackColor = true;
               this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
               //
               // tb2
               //
               this->tb2->Location = System::Drawing::Point(12, 98);
               this->tb2->Multiline = true;
               this->tb2->Name = L"tb2";
               this->tb2->Size = System::Drawing::Size(251, 51);
               this->tb2->TabIndex = 5;
               //
               // Form1
               //
               this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
               this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
               this->ClientSize = System::Drawing::Size(284, 303);
               this->Controls->Add(this->tb2);
               this->Controls->Add(this->button2);
               this->Controls->Add(this->button1);
               this->Controls->Add(this->thongbao);
               this->Controls->Add(this->tb);
               this->Controls->Add(this->xuat);
               this->Name = L"Form1";
               this->Text = L"Form1";
               this->ResumeLayout(false);
               this->PerformLayout();

            }
      #pragma endregion
            String^ bien;
         private: System::Void xuat_Click(System::Object^  sender, System::EventArgs^  e) {
                   thongbao->Text=L"Chào mừng Mừng Bạn Đến Với forum nhatcntt.come.vn+";
                    bien = tb->Text;
                  tb2->Text=bien;

                   MessageBox::Show(L"Yeah thành công rui ^^");
                }
         private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                this->Close();
                }
         private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
                   thongbao->Text="";
                   tb->Clear();
                   tb2->Clear();
               
                }
      };
      }
      Code:
      http://www.mediafire.com/?p3z6gb80q0tp4jh