I found this tutorial and I was able to implement it.
How can I disable a button when an errors occurs?
I searched a lot over the net, but I can't find a piece of code that resembles mine. (Yes, I know there about a zillion threads about this matter, but I just don't understand it.)
Here is my current code, it's a bit lengthy:
Public Class GradeVm
Implements IDataErrorInfo
Public Interface IDataErrorInfo
Default ReadOnly Property Item(columnName As String) As String
ReadOnly Property [Error]() As String
End Interface
#Region "Properties"
Property Grade As Integer
Property Adjust As Integer
#End Region
Public ReadOnly Property [Error] As String Implements IDataErrorInfo.Error
Get
Return "Error"
End Get
End Property
Default Public ReadOnly Property Item(columnName As String) As String Implements IDataErrorInfo.Item
Get
Select Case columnName
Case "Grade"
If IsNumeric(Me.Grade) = False Then
Return [Error]
End If
Case "Adjust"
If IsNumeric(Me.Adjust) = False Then
Return [Error]
End If
End Select
Return ""
End Get
End Property
End Class
This combined with the code here did the trick! Finally!! :)