I have created a class library of field definitions where each class
contains a single field (as a property) and the validations needed for
that field.  For example: our AssignedDate class is the following:

Public Class FieldObj_AssignedDate
    Private sValue As String

    WriteOnly Property Value() As String
        Set(ByVal value As String)
            If IsDate(value.Trim) Then
                sValue = value.Trim
            Else
                sValue = ""
            End If
        End Set
    End Property

    ReadOnly Property AsString() As String
        Get
            Return sValue
        End Get
    End Property

    ReadOnly Property AsDate() As Date
        Get
            Return CDate(sValue)
        End Get
    End Property

    Public Sub New()
        sValue = ""
    End Sub

    Public Sub Clear()
        sValue = ""
    End Sub
End Class


The problem I am having is when I try to set the value of a variable
that has been dimensioned using this class as the type, like the
following:

Dim WorkDate As FieldObj_AssignedDate
WorkDate = some string variable

The error states that a field of type FieldObj_AssignedDate cannot
accept a string value.  This is despite the fact that the WriteOnly
property inside the class is a string type.

I am obviously missing a concept here.  Could someone point me in the
right direction?  Thanks.

Reply via email to