
#pragma once
namespace My34 {
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^ lst;
protected:
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->lst = (gcnew System::Windows::Forms::ListBox());
this->SuspendLayout();
//
// lst
//
this->lst->FormattingEnabled = true;
this->lst->Items->AddRange(gcnew cli::array<>(8) {L"Item 1", L"Item 2", L"Item 3", L"Item 4", L"Item 5",
L"Item 6", L"Item 7", L"Item 8"});
this->lst->Location = System::Drawing::Point(8, 10);
this->lst->Name = L"lst";
this->lst->Size = System::Drawing::Size(271, 121);
this->lst->TabIndex = 0;
this->lst->DoubleClick += gcnew System::EventHandler(this, &Form1::lst_DoubleClick);
this->lst->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::lst_SelectedIndexChanged);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 141);
this->Controls->Add(this->lst);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
//Remove Items In ListBox
private: System::Void lst_DoubleClick(System::Object^ sender, System::EventArgs^ e) {
this->Text=lst->Text;
lst->Items->RemoveAt(lst->SelectedIndex);
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
this->Text="Romove Items In ListBox";
this->MaximizeBox=false;
}
private: System::Void lst_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
this->Text=lst->Text;
}
};
}