
#pragma once
namespace My32 {
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 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.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
///
/// Clean up any resources being used.
///
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::ListBox^ lstAddItems;
protected:
private: System::Windows::Forms::TextBox^ txtAdd;
private: System::Windows::Forms::Button^ BtnAdd;
private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
this->lstAddItems = (gcnew System::Windows::Forms::ListBox());
this->txtAdd = (gcnew System::Windows::Forms::TextBox());
this->BtnAdd = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// lstAddItems
//
this->lstAddItems->FormattingEnabled = true;
this->lstAddItems->Location = System::Drawing::Point(12, 14);
this->lstAddItems->Name = L"lstAddItems";
this->lstAddItems->Size = System::Drawing::Size(268, 199);
this->lstAddItems->TabIndex = 0;
//
// txtAdd
//
this->txtAdd->Location = System::Drawing::Point(14, 220);
this->txtAdd->Name = L"txtAdd";
this->txtAdd->Size = System::Drawing::Size(265, 20);
this->txtAdd->TabIndex = 1;
//
// BtnAdd
//
this->BtnAdd->Location = System::Drawing::Point(16, 251);
this->BtnAdd->Name = L"BtnAdd";
this->BtnAdd->Size = System::Drawing::Size(262, 27);
this->BtnAdd->TabIndex = 2;
this->BtnAdd->Text = L"Add to List";
this->BtnAdd->UseVisualStyleBackColor = true;
this->BtnAdd->Click += gcnew System::EventHandler(this, &Form1::BtnAdd_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(289, 285);
this->Controls->Add(this->BtnAdd);
this->Controls->Add(this->txtAdd);
this->Controls->Add(this->lstAddItems);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
//Add Items In ListBox
private: System::Void BtnAdd_Click(System::Object^ sender, System::EventArgs^ e) {
lstAddItems->Items->Add(txtAdd->Text);
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
this->Text="Add Items in ListBox";
this->MaximizeBox=false;
txtAdd->Text="Add Items";
}
};
}