winform文本框验证问题
我在文本框中输入值后直接点击按钮能先验证文本框中的值吗?求解???
private void button1_Click(object sender, EventArgs e) { String txt = this.txt.Text.Trim(); if (txt == "") { MessageBox.Show("文本框无值"); }else { MessageBox.Show("文本框有值"); } }
private void button1_Click(object sender, EventArgs e) { String txt = this.txt.Text.Trim(); if (txt == "") { MessageBox.Show("文本框无值"); }else { MessageBox.Show("文本框有值"); } }
private void button1_Click(object sender, EventArgs e) { String txt = this.txt.Text.Trim(); if (txt == "") { MessageBox.Show("文本框无值"); }else { MessageBox.Show("文本框有值"); } }