very simple question, how to combine and or operators into the same statement.
c.GetType is getType(TextBox) AND foo or bar or baz
this is not working
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
this works:
For Each c As Control In Me.Controls
If (c.GetType Is GetType(TextBox)) And (c.Name <> "txtID") Then
'do something
End If
Next
thanks, I’m a .net newbie!
By the way, you can use LINQ which improves the intelligibility.:
OfTypereturns only the controls of the given type, in this case TextBoxesWherefilters the controls by theNameproperty (note:AndandAndAlsodifference)For Eachiterates the resultingIEnumerable(Of TextBox)