C# 一个label的值怎么和textbox的值进行比较?label的值不能引用label.text这要如何进行比较?
// 放1个Label、1个TextBox、1个Button
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.label1.Text == this.textBox1.Text) {
MessageBox.Show("相等");
}else{
MessageBox.Show("不等");
}
}
}