C# 怎样点击一个按钮时将label的Text内容显示到listBox1的Items中?

如题所述

        private void button1_Click(object sender, EventArgs e)
        {
            string s = this.label1.Text;
            if (this.listBox1.Items.Contains(s))
                MessageBox.Show("不能重复添加!");
            else
                this.listBox1.Items.Add(s);
        }

温馨提示:答案为网友推荐,仅供参考
相似回答