Reputation: 109
I need to convert item.MergedDate, which is a date, to a string.
Code as follows
If item.MergeDate.ToString() = "12/31/9999 11:59:59 PM" Then
item.MergeDate = ""
End If
Obviously this is a terrible attempt, but
I have tried = Nothing and didnt work.
Thank You
Upvotes: 0
Views: 1136
Reputation: 1749
Just an extension of SSS idea, but you could add another property to item, MergeDateAsString (Or overload it i suppose)
Public Property Merge() As String
Get
Return _MergeDate
End Get
Set(ByVal value As String)
_MergeDate = value
End Set
End Property
Public ReadOnly Property MergeDateAsString
Get
Dim returnValue As String = String.Empty
If _MergeDate <> Date.MinValue Then
returnValue = _MergeDate.ToString
End If
Return returnValue
End Get
End Property
And then bind to the new property instead
Upvotes: 1
Reputation: 5403
Change the data type of the Item.MergeDate property to a String
You can't store text in a Date variable.
Upvotes: 0