给控件命名有规律的名称,比如所有需要判断非空的控件加上某个前缀,以及有意义的名称,如:no_编号、no_姓名、no_日期、......
For Each c As WinForm.Control In e.Form.Controls
If c.name.StartsWith("no_") Then
Dim t = c
If t.Text = "" Then
Messagebox.Show(t.name.split("_")(1) & "无内容,无法打印","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
t.Select()
Return
End If
End If
Next