using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Dictionary
{
public partial class Form1 : Form
{
private static string[,] str = new string[20,20];//定义一个二维的字符型数组
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i=0;
str[i,0]=this.textBox1.Text;//添加存在的元素
str[i,1]=this.textBox2.Text;
i++;
if (i > 20)
{
MessageBox.Show("存储空间不足!!!");
}
}
private void button2_Click_1(object sender, EventArgs e)
{
bool x=true;
do
{
for (int i = 0; i < 20; i++) //遍历书籍
{
if (textBox4.Text == str[i, 0])
{
textBox3.Text = str[i,1];//输出字的值
x = false;
}
}
} while (x);
}
}
}