Created
August 11, 2013 06:19
-
-
Save viko16/6203662 to your computer and use it in GitHub Desktop.
检查各个控件是否有空值 #winform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 检查各个控件是否有空值 | |
/// </summary> | |
/// <returns>无空值返回true</returns> | |
private Boolean CheckEmpty() | |
{ | |
foreach (Control cur in this.Controls) | |
{ | |
//if (cur is TextBox && cur.Text == "") /*两种方式皆可,下面的更好*/ | |
if(cur is TextBox && string.IsNullOrEmpty(cur)) | |
{ | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment