检查特定文本框是否为空

时间:2014-02-02 19:12:44

标签: vb.net textbox null

我知道下面的代码可用于检查空文本框。

Dim emptyTextBoxes =
From txt In Me.Controls.OfType(Of TextBox)()
Where txt.Text.Length = 0
Select txt.Name
If emptyTextBoxes.Any Then
MessageBox.Show(String.Format("Please fill following textboxes: {0}",
                String.Join(",", emptyTextBoxes)))
End If

如果我只想检查特定的texbox,该怎么办?例如,我有10个文本框,我只想要检查其中的6个是否为空

0 个答案:

没有答案