Sure you can, see the implementation below. This example is a copy/paste code from my project in which I added a class "ValidationInstance" which holds a collection of items which should be checked (or préfilled before the handler IsValid will be raisen).
Dim iPropertyCount As Integer = 0
For Each PropertyItem As PropertyInfo In yourClass.GetType().GetProperties()
Select Case iPropertyCount
Case 1 To 10
'add the properties of this class to then validation instance
Dim strToAdd As String = String.Empty
If Not PropertyItem.GetValue(yourClass, Nothing) = Nothing Then
strToAdd = PropertyItem.GetValue(yourClass, Nothing).ToString()
End If
yourClass.ValidationInstance.ValidateRequired(PropertyItem.Name, _
strToAdd.ToString)
End Select
iPropertyCount += 1
Next 4advanced
Junior Poster in Training
67 posts since Nov 2008
Reputation Points: 33
Solved Threads: 10