如何向用户指示哪个textBox为空或为空?

use*_*129 2 c# winforms

我有一个带有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)

Tig*_*ran 6

Most common practise is use User input validation.

You can use ErrorProvider class to validate and notify to the user.