非常簡單的問題,如何結合和或運營商到相同的陳述。vb.net結合和或或運營商
c.GetType是的getType(文本框)和Foo或酒吧或巴茲
這是行不通的
For Each c As Control In Me.Controls
If (c.GetType Is GetType(TextBox)) And ((c.Name <> "txtID") Or (c.Name <> "txtAltEmail")) Then
'do something
End If
Next
這個工程:
For Each c As Control In Me.Controls
If (c.GetType Is GetType(TextBox)) And (c.Name <> "txtID") Then
'do something
End If
Next
感謝,我是。網新手!
你得到什麼錯誤?第一個陳述對我來說很好 – Luis 2012-07-11 22:03:32
@ LuisSchechez:第一個語句等同於'If(c.GetType是GetType(TextBox))和True Then'。 – Heinzi 2012-07-11 22:14:23
@Heinzi事實上,我在那裏看到和'='而不是'<>' – Luis 2012-07-11 22:23:37