Chào mọi người!
E đang làm đề tài thực tập nghiên cứu về bảng Băm và phép Băm. Sau khi làm chương trình dạng console ổn rồi thì thầy yêu cầu làm giao diện đồ họa. Đây là lần đầu tiên e làm 1 ứng dụng windows forms nên chưa hiểu cấu trúc dữ liệu của nó. Mong các bác giúp e vấn đề này.
Chương trình sẽ input 1 file HoSo.Dat gồm 5 trường 100 phần tử, lưu vào mảng có cấu trúc struct NhanVien. Sau đó sẽ tiến hành băm 2 trường là Mã Nhân Viên và Luơng, lưu vào 2 mảng.
Bây h e muốn khi click vào các nút như Hồ Sơ Nhân Viên, Mã Nhân Viên hoặc Luơng thì sẽ in ra dữ liệu. Vấn đề là cứ mỗi lần click vào 1 nút thì phải thực hiện lại các công việc như DocFile hoặc băm lại dữ liệu. Các bác có thể chỉ giúp e cách truyền dữ liệu để khi click vào nút thì sẽ in dữ liệu ra mà không cần thực hiện lại các công việc như tạo bảng băm được không. Thank các bác.
Hàm main cũ :
Mã:
NV a;
	Ma b;
	L c;

	DocFile(a);//Doc du lieu

	//Tao bang Bam
	InitMaNV(b);
	InitLuong(c);

	//Them khoa vao bang Bam
	for(int i = 0; i < M; i++)
	{
		InsertMaNV(b,a[i].Stt,a[i].MaNV);
		InsertLuong(c,a[i].Stt,a[i].Luong);
	}
	GhiFileMaNV(b);
	GhiFileLuong(c);
Chuơng trình Windows Forms : Form1.h
Mã:
#pragma once
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#using <mscorlib.dll>

#define NULLKEY -1
#define M 100 //So phan tu cua bang Bam
#define TRUE 1
#define FALSE 0

int SoNutMaNV = 0;
int SoNutLuong = 0;

//Khai bao cau truc du lieu Nhan Vien
struct NhanVien
{
	int Stt;
	int MaNV;
	char TenNV[15];
	int NamSinh;
	int GioiTinh;
	int Luong;
};
typedef struct NhanVien NV[M];

//Khai bao cau truc bang Bam gom Khoa va vi tri trong CSDL
struct HashMaNV
{
	int KeyMaNV;
	int SttMaNV;
};
typedef struct HashMaNV Ma[M];

struct HashLuong
{
	int KeyLuong;
	int SttLuong;
};
typedef struct HashLuong L[M];

//Doc file du lieu HoSo.Dat
void DocFile(NV A)
{
	FILE *f;
	/*	f = fopen("D:\\Ki3\\Hash\\Rand\\HoSo.DAT","rt");*/
	f = fopen("HoSo.DAT","rt");
	for (int i=0; i < M; i++)
	{
		fscanf(f,"%d %d %s %d %d %d",&A[i].Stt,&A[i].MaNV,&A[i].TenNV,&A[i].NamSinh,&A[i].GioiTinh,&A[i].Luong);
	}
	fclose(f);
}

//Ghi bang Bam MaNhanVien ra file MaNhanVien.Dat
void GhiFileMaNV(Ma B)
{
	FILE *p;
	p = fopen("MaNhanVien.DAT","wt");
	for (int i=0; i < M; i++)
	{
		fprintf(p,"%3d   %d    %3d 
",i+1,B[i].KeyMaNV,B[i].SttMaNV);
	}
	fclose(p);
}

//Ghi bang Bam Luong.DAT ra file Luong.DAT
void GhiFileLuong(L C)
{
	FILE *t;
	t = fopen("Luong.DAT","wt");
	for (int i=0; i < M; i++)
	{
		fprintf(t,"%3d   %d   %3d 
",i+1,C[i].KeyLuong,C[i].SttLuong);
	}
	fclose(t);
}

//Tao bang Bam Ma Nhan Vien M nut
void InitMaNV(Ma B)
{
	for(int i=0; i < M; i++)
	{
		B[i].KeyMaNV = NULLKEY;
		B[i].SttMaNV = NULLKEY;
	}
}

//Tao bang Bam Luong M nut
void InitLuong(L C)
{
	for(int i=0; i < M; i++)
	{
		C[i].KeyLuong = NULLKEY;
		C[i].SttLuong = NULLKEY;
	}
}

//Thong thuong se chon M = 100, nhung neu nhu the thi khi bam ra cac dia chi khoa se phu thuoc vao 2 so cuoi.
//Vi du : 8855 mod 100 -> 55
//Chon M = 97 de cac gia tri bam duoc ngau nhien hon
int HashFunction(int k)
{
	return(k % 97);
}

//Kiem tra bang Bam rong
int isEmptyMaNV()
{
	return(SoNutMaNV == 0 ? TRUE:FALSE);
}

int isEmptyLuong()
{
	return(SoNutLuong == 0 ? TRUE:FALSE);
}

//Kiem tra bang Bam day
int isFullMaNV()
{
	return (SoNutMaNV == M ? TRUE:FALSE);
}

int isFullLuong()
{
	return (SoNutLuong == M ? TRUE:FALSE);
}

//Them 1 khoa moi vao bang Bam MaNhanVien
int InsertMaNV(Ma B, int j, int k)
{
	int i;
	if(isFullMaNV())
	{
		printf("
 Bang bam Ma Nhan Vien bi day khong them nut co khoa %d duoc",k);
		return 0;
	}
	i = HashFunction(k);
	while(B[i].KeyMaNV != NULLKEY)
	{
		//Bam lai (theo phuong phap do tuyen tinh)
		i ++;
		if(i >= M)
			i = i - M;
	}
	B[i].KeyMaNV = k;
	B[i].SttMaNV = j;//Luu lai vi tri cua khoa trong file HoSo.Dat
	SoNutMaNV++;
}

//Them 1 khoa moi vao bang Bam Luong
int InsertLuong(L C, int j, int k)
{
	int i;
	if(isFullLuong())
	{
		printf("
 Bang bam Luong bi day khong them nut co khoa %d duoc",k);
		return 0;
	}
	i = HashFunction(k);
	while(C[i].KeyLuong != NULLKEY)
	{
		//Bam lai (theo phuong phap do tuyen tinh)
		i ++;
		if(i >= M)
			i = i - M;
	}
	C[i].KeyLuong = k;
	C[i].SttLuong = j;//Luu lai vi tri cua khoa trong file HoSo.Dat
	SoNutLuong++;
}

//Ham tim kiem 1 khoa trong Bang bam Ma Nhan Vien
int SearchMaNV(Ma B, int k)
{
	int i = HashFunction(k);
	int x = i;
	if(B[i].KeyMaNV == k)
		return(i);//Tim thay
	while(B[i].KeyMaNV != k && B[i].KeyMaNV != NULLKEY)
	{
		//Bam lai theo phuong phap tham do tuyen tinh
		i++;
		if(i >= M)
			i = i - M;
		if(i == x)
			return -1;//khong tim thay
		//printf("Da check vi tri %d 
",i);
	}
}

//Ham tim kiem 1 khoa trong Bang bam Luong
int SearchLuong(L C, int k)
{
	int i = HashFunction(k);
	int x = i;
	if(C[i].KeyLuong == k)
		return(i);//tim thay
	while(C[i].KeyLuong != k && C[i].KeyLuong != NULLKEY)
	{
		//Bam lai theo phuong phap tham do tuyen tinh
		i++;
		if(i >= M)
			i = i - M;
		if(i == x)
			return -1;//khong tim thay
		//printf("Da check vi tri %d 
",i);
	}
}

namespace HashPJ 
{
	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
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
			System::Windows::Forms::ListViewItem^ listViewItem;
		}

	protected: 

	public: System::Windows::Forms::Button^  button1;
	public: System::Windows::Forms::Button^  button2;
	public: System::Windows::Forms::Button^  button3;
	public: System::Windows::Forms::Button^  button4;
	public: System::Windows::Forms::Button^  button5;

	private: System::Windows::Forms::TextBox^  textBox1;
	private: System::Windows::Forms::TextBox^  textBox2;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::MenuStrip^  menuStrip1;
	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  aboutToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  helpToolStripMenuItem;
	private: System::Windows::Forms::ListView^  listView1;
	private: System::Windows::Forms::ColumnHeader^  STT;
	private: System::Windows::Forms::ColumnHeader^  MaNV;
	private: System::Windows::Forms::ColumnHeader^  TenNV;
	private: System::Windows::Forms::ColumnHeader^  NamSinh;
	private: System::Windows::Forms::ColumnHeader^  GioiTinh;
	private: System::Windows::Forms::ColumnHeader^  Luong;

	private: System::ComponentModel::IContainer^  components;


	protected: 

	protected: 

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>


#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->button1 = (gcnew System::Windows::Forms::Button());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
			this->button4 = (gcnew System::Windows::Forms::Button());
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->button5 = (gcnew System::Windows::Forms::Button());
			this->listView1 = (gcnew System::Windows::Forms::ListView());
			this->STT = (gcnew System::Windows::Forms::ColumnHeader());
			this->MaNV = (gcnew System::Windows::Forms::ColumnHeader());
			this->TenNV = (gcnew System::Windows::Forms::ColumnHeader());
			this->NamSinh = (gcnew System::Windows::Forms::ColumnHeader());
			this->GioiTinh = (gcnew System::Windows::Forms::ColumnHeader());
			this->Luong = (gcnew System::Windows::Forms::ColumnHeader());
			this->menuStrip1->SuspendLayout();
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(12, 27);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(108, 23);
			this->button1->TabIndex = 1;
			this->button1->Text = L"Hồ Sơ Nhân Viên";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(172, 27);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(110, 23);
			this->button2->TabIndex = 3;
			this->button2->Text = L"Mã Nhân Viên";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(330, 27);
			this->button3->Name = L"button3";
			this->button3->Size = System::Drawing::Size(110, 23);
			this->button3->TabIndex = 3;
			this->button3->Text = L"Lương";
			this->button3->UseVisualStyleBackColor = true;
			this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(115, 57);
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System::Drawing::Size(226, 20);
			this->textBox1->TabIndex = 4;
			// 
			// textBox2
			// 
			this->textBox2->Location = System::Drawing::Point(115, 85);
			this->textBox2->Name = L"textBox2";
			this->textBox2->Size = System::Drawing::Size(226, 20);
			this->textBox2->TabIndex = 5;
			// 
			// button4
			// 
			this->button4->Location = System::Drawing::Point(365, 54);
			this->button4->Name = L"button4";
			this->button4->Size = System::Drawing::Size(75, 23);
			this->button4->TabIndex = 7;
			this->button4->Text = L"Search";
			this->button4->UseVisualStyleBackColor = true;
			this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
			// 
			// menuStrip1
			// 
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
				this->aboutToolStripMenuItem, this->helpToolStripMenuItem});
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
			this->menuStrip1->Name = L"menuStrip1";
			this->menuStrip1->Size = System::Drawing::Size(452, 24);
			this->menuStrip1->TabIndex = 9;
			this->menuStrip1->Text = L"menuStrip1";
			// 
			// fileToolStripMenuItem
			// 
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->exitToolStripMenuItem});
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
			this->fileToolStripMenuItem->Text = L"File";
			this->fileToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fileToolStripMenuItem_Click);
			// 
			// exitToolStripMenuItem
			// 
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
			this->exitToolStripMenuItem->Size = System::Drawing::Size(92, 22);
			this->exitToolStripMenuItem->Text = L"Exit";
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
			// 
			// aboutToolStripMenuItem
			// 
			this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
			this->aboutToolStripMenuItem->Size = System::Drawing::Size(52, 20);
			this->aboutToolStripMenuItem->Text = L"About";
			this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aboutToolStripMenuItem_Click);
			// 
			// helpToolStripMenuItem
			// 
			this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
			this->helpToolStripMenuItem->Size = System::Drawing::Size(44, 20);
			this->helpToolStripMenuItem->Text = L"Help";
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(12, 61);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(75, 13);
			this->label1->TabIndex = 10;
			this->label1->Text = L"Mã Nhân Viên";
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System::Drawing::Point(12, 88);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(37, 13);
			this->label2->TabIndex = 11;
			this->label2->Text = L"Lương";
			// 
			// button5
			// 
			this->button5->Location = System::Drawing::Point(365, 84);
			this->button5->Name = L"button5";
			this->button5->Size = System::Drawing::Size(75, 23);
			this->button5->TabIndex = 12;
			this->button5->Text = L"Search";
			this->button5->UseVisualStyleBackColor = true;
			this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
			// 
			// listView1
			// 
			this->listView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(6) {this->STT, this->MaNV, 
				this->TenNV, this->NamSinh, this->GioiTinh, this->Luong});
			this->listView1->Location = System::Drawing::Point(12, 123);
			this->listView1->Name = L"listView1";
			this->listView1->Size = System::Drawing::Size(428, 459);
			this->listView1->TabIndex = 0;
			this->listView1->UseCompatibleStateImageBehavior = false;
			this->listView1->View = System::Windows::Forms::View::Details;
			// 
			// STT
			// 
			this->STT->Text = L"STT";
			this->STT->Width = 35;
			// 
			// MaNV
			// 
			this->MaNV->Text = L"Mã Nhân Viên";
			this->MaNV->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->MaNV->Width = 87;
			// 
			// TenNV
			// 
			this->TenNV->Text = L"Tên Nhân Viên";
			this->TenNV->Width = 117;
			// 
			// NamSinh
			// 
			this->NamSinh->Text = L"Năm Sinh";
			this->NamSinh->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->NamSinh->Width = 65;
			// 
			// GioiTinh
			// 
			this->GioiTinh->Text = L"Giới Tính";
			this->GioiTinh->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->GioiTinh->Width = 58;
			// 
			// Luong
			// 
			this->Luong->Text = L"Lương";
			this->Luong->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->Luong->Width = 50;
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(452, 582);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->listView1);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->button5);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->menuStrip1);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->button4);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->label1);
			this->MainMenuStrip = this->menuStrip1;
			this->Name = L"Form1";
			this->Text = L"Hashing";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->menuStrip1->ResumeLayout(false);
			this->menuStrip1->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();
		}
			


#pragma endregion


public:System::Void folderBrowserDialog1_HelpRequest(System::Object^  sender, System::EventArgs^  e) 
{
}

public:System:: Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
	   {
		   NV A;
		   DocFile(A);
		   listView1->Items->Clear();
		   for ( int i = 0; i < M; i++ )
		   {
			   String^ Ten = gcnew String (reinterpret_cast<const char*>(A[i].TenNV));
			   // Create three items and three sets of subitems for each item.
			   ListViewItem^ item = gcnew ListViewItem(A[i].Stt.ToString());
			   // Place a check mark next to the item.
			   item->SubItems->Add(A[i].MaNV.ToString());
			   item->SubItems->Add(Ten);
			   item->SubItems->Add(A[i].NamSinh.ToString());
			   item->SubItems->Add(A[i].GioiTinh.ToString());
			   item->SubItems->Add(A[i].Luong.ToString());
			   //Add the items to the ListView. 
			   array<ListViewItem^>^temp = {item};
			   listView1->Items->AddRange( temp );
		   }
	   }
public:System:: Void button2_Click(System::Object^  sender, System::EventArgs^  e) 
			 {			 
				 NV a;
				 Ma b;
				 DocFile(a);//Doc du lieu
				 //Tao bang Bam
				 InitMaNV(b);
				 //Them khoa vao bang Bam
				 for(int i = 0; i < M; i++)
				 {
					 InsertMaNV(b,a[i].Stt,a[i].MaNV);
				 }
				 GhiFileMaNV(b);
				 listView1->Items->Clear();
				 for ( int i = 0; i < M; i++ )
				 {
					 // Create three items and three sets of subitems for each item.
					 ListViewItem^ item = gcnew ListViewItem(b[i].SttMaNV.ToString());
					 // Place a check mark next to the item.
					 item->SubItems->Add(b[i].KeyMaNV.ToString());
					 array<ListViewItem^>^temp = {item};
					 listView1->Items->AddRange( temp );
				 }
			 }
public:System:: Void button3_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
			 NV a;
			 L c;
			 DocFile(a);//Doc du lieu
			 //Tao bang Bam
			 InitLuong(c);
			 //Them khoa vao bang Bam
			 for(int i = 0; i < M; i++)
			 {
				 InsertLuong(c,a[i].Stt,a[i].Luong);
			 }
			 GhiFileLuong(c);
			 listView1->Items->Clear();
			 for ( int i = 0; i < M; i++ )
			 {
				 // Create three items and three sets of subitems for each item.
				 ListViewItem^ item = gcnew ListViewItem(c[i].SttLuong.ToString());
				 // Place a check mark next to the item.
				 item->SubItems->Add("");
				 item->SubItems->Add("");
				 item->SubItems->Add("");
				 item->SubItems->Add("");
				 item->SubItems->Add(c[i].KeyLuong.ToString());
				 //Add the items to the ListView. 
				 array<ListViewItem^>^temp = {item};
				 listView1->Items->AddRange( temp );
			 }

		 }
public:System:: Void button4_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
			 NV a;
			 Ma b;

			 DocFile(a);//Doc du lieu

			 //Tao bang Bam
			 InitMaNV(b);

			 //Them khoa vao bang Bam
			 for(int i = 0; i < M; i++)
			 {
				 InsertMaNV(b,a[i].Stt,a[i].MaNV);
			 }
			 GhiFileMaNV(b);
			 listView1->Items->Clear();
			 String ^ SMaNV = textBox1->Text;
			 int IMaNV = Int32::Parse(SMaNV);

			 int Result = SearchMaNV(b,IMaNV);
			 if (Result == -1)
			 {
				// Initializes the variables to pass to the MessageBox::Show method.
				String^ message = "Khong tim thay khoa trong bang Bam";
				String^ caption = "Error!!!";
				MessageBoxButtons buttons = MessageBoxButtons::OK;
				System::Windows::Forms::DialogResult result;

				// Displays the MessageBox.
				result = MessageBox::Show( this, message, caption, buttons );
			 }
			 else
			 {
				 for (int i = 0; i < M; i ++)
				 {
					 int x;
					 if (IMaNV == b[i].KeyMaNV)
					 {
						 x = b[i].SttMaNV - 1;//Vi Stt trong HoSo.Dat bat dau tu 1
						 String^ Ten = gcnew String (reinterpret_cast<const char*>(a[x].TenNV));
						 // Create three items and three sets of subitems for each item.
						 ListViewItem^ item = gcnew ListViewItem(a[x].Stt.ToString());
						 // Place a check mark next to the item.
						 item->SubItems->Add(a[x].MaNV.ToString());
						 item->SubItems->Add(Ten);
						 item->SubItems->Add(a[x].NamSinh.ToString());
						 item->SubItems->Add(a[x].GioiTinh.ToString());
						 item->SubItems->Add(a[x].Luong.ToString());
						 //Add the items to the ListView. 
						 array<ListViewItem^>^temp = {item};
						 listView1->Items->AddRange( temp );
					 }
				 }
			 }
		 }
public:System:: Void fileToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
		 }
public:System:: Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
			 // Initializes the variables to pass to the MessageBox::Show method.
			 String^ message = "Hash Table 
 © 2013 Nguyen Phi Cuong 
 Mail : cuongnp.bkhn@gmail.com";
			 String^ caption = "About";
			 MessageBoxButtons buttons = MessageBoxButtons::OK;
			 System::Windows::Forms::DialogResult result;

			 // Displays the MessageBox.
			 result = MessageBox::Show( this, message, caption, buttons );
		 }
public:System:: Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
			 Close();
		 }
private: System:: Void button5_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
			 NV a;
			 L c;

			 DocFile(a);//Doc du lieu

			 //Tao bang Bam
			 InitLuong(c);

			 //Them khoa vao bang Bam
			 for(int i = 0; i < M; i++)
			 {
				 InsertLuong(c,a[i].Stt,a[i].Luong);
			 }
			 GhiFileLuong(c);
			 listView1->Items->Clear();
			 String ^ SLuong = textBox2->Text;
			 int ILuong = Int32::Parse(SLuong);

			 int Result = SearchLuong(c,ILuong);
			 if (Result == -1)
			 {
				 // Initializes the variables to pass to the MessageBox::Show method.
				 String^ message = "Khong tim thay khoa trong bang Bam";
				 String^ caption = "Error!!!";
				 MessageBoxButtons buttons = MessageBoxButtons::OK;
				 System::Windows::Forms::DialogResult result;

				 // Displays the MessageBox.
				 result = MessageBox::Show( this, message, caption, buttons );
			 }
			 else
			 {
				 for (int i = 0; i < M; i ++)
				 {
					 int x;
					 if (ILuong == c[i].KeyLuong)
					 {
						 x = c[i].SttLuong - 1;//Vi Stt trong HoSo.Dat bat dau tu 1
						 String^ Ten = gcnew String (reinterpret_cast<const char*>(a[x].TenNV));
						 // Create three items and three sets of subitems for each item.
						 ListViewItem^ item = gcnew ListViewItem(a[x].Stt.ToString());
						 // Place a check mark next to the item.
						 item->SubItems->Add(a[x].MaNV.ToString());
						 item->SubItems->Add(Ten);
						 item->SubItems->Add(a[x].NamSinh.ToString());
						 item->SubItems->Add(a[x].GioiTinh.ToString());
						 item->SubItems->Add(a[x].Luong.ToString());
						 //Add the items to the ListView. 
						 array<ListViewItem^>^temp = {item};
						 listView1->Items->AddRange( temp );
					 }
				 }
			 }
		 }
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) 
		 {
		 }
};
}
[IMG]http:/w4.upanh.com/b2.s38.d3/4b269e1b61ff24970d8af0207e5b39f6_55188854.nhchupma nhinh20130428181055.jpg[/IMG]