我有一个带有9个TextBox控件的WinForm应用程序.如何提醒用户哪些文本框为空或为空?
var incompleteTextBoxes = this.Controls.OfType<TextBox>().Where(tb => string.IsNullOrWhiteSpace(tb.Text));
foreach (var textBox in inCompleteTextBoxes)
{
// give user feedback about which text boxes they have yet to fill out
}
Run Code Online (Sandbox Code Playgroud)