If it's a string, you can just set it to
Nothing
, because
String
is a reference type.
yourString = Nothing
But for a value type (and DateTime is one),
Nothing
gives it the equivalent to
default(T)
in C#, and for DateTime, this is
DateTime.MinValue
. If you want to set it to
Nothing
, make
OfficeWorkApproveDate
a
nullable type[
^] (so when you create the variable, add a question mark after the variable name).
Then you can give it the
Nothing
value:
rational_obj.OfficeWorkApproveDate = Nothing
And later, if you want to test whether it has a value, try this:
If rational_obj.OfficeWorkApproveDate.HasValue Then
Dim approveDate As DateTime = rational_obj.OfficeWordApproveDate.Value
Else
End If