private void button1_Click(object sender, EventArgs e)
{
int x = 0;
for (int i = 0; i < this.comboBox1.Items.Count; i++)
{
if (this.comboBox1.Text.Trim() == this.comboBox1.Items[i].ToString())
{
x++;
}
}
if (x == 0)
{
this.comboBox1.Items.Add(this.comboBox1.Text);
}
else
{
MessageBox.Show("有相同项,不能添加");
}
}