我有一个infopath数据源中的14个字段的列表,我试图循环它们以检查空格。这就是我放在一起,但它不喜欢UserInput之后的Field我会把它看起来也应该是这样的:
需要它以这种方式工作:
Private Sub ClearSpaces()
For i As Integer = 1 To 14
Dim DayString As String = System.Convert.ToString(i)
Dim Field As String = "Reason" & DayString
If String.IsNullOrEmpty(UserInput.Field.Trim()) Then
MessageBox.Show("Day " & DayString, "OK", MessageBoxButtons.OK)
End If
Next
End Sub
这适用于Reason1:
Private Sub ClearSpaces()
For i As Integer = 1 To 14
Dim DayString As String = System.Convert.ToString(i)
Dim Field As String = "Reason" & DayString
If String.IsNullOrEmpty(UserInput.Reason1.Trim()) Then
MessageBox.Show("Day " & DayString, "OK", MessageBoxButtons.OK)
End If
Next
End Sub