Glen,
I would do something like:
'
' Copyright © 2005, Jay B. Harlow, All Rights Reserved.
'
Option Strict On
Option Explicit On
Imports System.Componen tModel
Public Class Person
Implements INotifyProperty Changed
Implements IDataErrorInfo
Private m_name As String
Public Property Name() As String
Get
Return m_name
End Get
Set(ByVal value As String)
If value = "" Then
ColumnError("Sa lary") = "Name is blank!"
Else
ColumnError("Sa lary") = ""
End If
m_name = value
Dim e As New PropertyChanged EventArgs("Name ")
OnPropertyChang ed(e)
End Set
End Property
#Region " INotifyProperty Changed support "
Public Event PropertyChanged (ByVal sender As Object, ByVal e As
PropertyChanged EventArgs) Implements INotifyProperty Changed.Propert yChanged
Protected Overridable Sub OnPropertyChang ed(ByVal e As
PropertyChanged EventArgs)
RaiseEvent PropertyChanged (Me, e)
End Sub
#End Region
#Region " IDataErrorInfo support "
Private m_rowError As String
Private m_columnErrors As New
System.Collecti ons.Specialized .StringDictiona ry
Private ReadOnly Property IDataErrorInfo_ Error() As String Implements
IDataErrorInfo. Error
Get
Return m_rowError
End Get
End Property
Private ReadOnly Property IDataErrorInfo_ Item(ByVal columnName As
String) As String Implements IDataErrorInfo. Item
Get
Return m_columnErrors( columnName)
End Get
End Property
Public Property RowError() As String
Get
Return m_rowError
End Get
Set(ByVal value As String)
m_rowError = value
End Set
End Property
Public Property ColumnError(ByV al columnName As String) As String
Get
Return m_columnErrors( columnName)
End Get
Set(ByVal value As String)
m_columnErrors( columnName) = value
End Set
End Property
Public Sub ClearErrors()
m_rowError = ""
m_columnErrors. Clear()
End Sub
#End Region
End Class
Public Class Employee
Inherits Person
Private m_salary As Decimal
Public Property Salary() As Decimal
Get
Return m_salary
End Get
Set(ByVal value As Decimal)
If value < 0 Then
ColumnError("Sa lary") = "Salary less then 0!"
Else
ColumnError("Sa lary") = ""
End If
m_salary = value
Dim e As New PropertyChanged EventArgs("Sala ry")
OnPropertyChang ed(e)
End Set
End Property
End Class
NOTE: I did not add error checking to the ColumnError or RowError
properties...
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Glen Wolinsky" <gw*******@mill ermartin.com> wrote in message
news:OV******** ******@TK2MSFTN GP10.phx.gbl...
| Jay,
|
| Talk about having a "duh" moment. That works perfectly. I REALLY don't
| know why I didn't think of it.
|
| However, at the risk of repeating the "duh" offense, I am also trying to
| implement the IDataErrorInfo interface. The difference here is that the
| items I'm dealing with are not methods as in the INotifyProperty Changed
| interface. IDataErrorInfo implements two properties. I'm running into
| the same problem as described previously.
|
| Do you have another bit of charity for this VERY tired amateur? ;o)
|
| Thanks,
| Glen
|
<<snip>>