I am getting an ambiguous matche exception on a piece of code and I dont know why. I have a similar property setup that runs just fine....
This Property runs fine.
--------------------------------------
#Region "PrePack Enumeration"
Public Enum PrePackTypes
ICEPACK
TRAYPACK
End Enum
' Private mPrepack As Boolean
Private xPrepack As PrePackTypes
Public Shadows Property Prepack() As PrePackTypes
Get
Select Case MyBase.PrePack
Case True
xPrepack = PrePackTypes.TRAYPACK
Case False
xPrepack = PrePackTypes.ICEPACK
End Select
Return xPrepack
End Get
Set(ByVal Value As PrePackTypes)
xPrepack = Value
Select Case xPrepack
Case PrePackTypes.ICEPACK
MyBase.PrePack = False
Case PrePackTypes.TRAYPACK
MyBase.PrePack = True
End Select
End Set
End Property
#End Region
----------------------------------------------------------------
This property does not
=============================================
#Region "TareType Enumeration"
Public Enum TareTypes
STANDARD
PERCENTAGE
End Enum
'Private mTareType As Boolean
Private xTaretype As TareTypes
Public Shadows Property TareType() As TareTypes
Get
Select Case MyBase.TareType
Case True
xTaretype = TareTypes.PERCENTAGE
Case False
xTaretype = TareTypes.STANDARD
End Select
Return xTaretype
End Get
Set(ByVal Value As TareTypes)
xTaretype = Value
Select Case xTaretype
Case TareTypes.PERCENTAGE
MyBase.TareType = True
Case TareTypes.STANDARD
MyBase.TareType = False
End Select
End Set
End Property
'
#End Region
=========================================
Here is the line of code I am processing.
++++++++++++++++++++++++++++++++++++++++++
Public Shared Function checkForChanges(ByVal obj As Object, ByVal obj_original As Object, ByVal pType As Type) As Boolean
Dim ischanged As Boolean = False
Try
Dim Properties() As PropertyInfo = pType.GetProperties(BindingFlags.Public Or BindingFlags.Instance)
Dim PropertyItem As PropertyInfo
For Each PropertyItem In Properties
With PropertyItem
******************
BREAKS HERE*****
******************
Debug.WriteLine(String.Format("New {0}={1}", obj.GetType.GetProperty(PropertyItem.Name).Name, obj.GetType.GetProperty(PropertyItem.Name).GetValu e(obj, Nothing)))
Debug.WriteLine(String.Format("Original {0}={1}", obj_original.GetType.GetProperty(PropertyItem.Name ).Name, obj_original.GetType.GetProperty(PropertyItem.Name ).GetValue(obj_original, Nothing)))
*******************
If ischanged = False Then
******************
BREAKS HERE*****
******************
If Not obj.GetType.GetProperty(PropertyItem.Name).GetValu e(obj, Nothing).Equals(obj_original.GetType.GetProperty(P ropertyItem.Name).GetValue(obj_original, Nothing)) Then
******************
ischanged = True
End If
End If
End With
Next
Return ischanged
Catch ex As Exception
MessageBox.Show(ex.ToString, "Exception Thrown")
Return False
Finally
End Try
End Function
--Eric Cathell, MCSA