What is the purpose of the Nullable property. Regardless if it is set to True, the MinDate Property cannot be Null or Nothing and the DateTime Property cannot be Null or Nothing. So, how do you get the control to display nothing when the data field is Nullable and the current record has a Null value.
regards,
Rob
Well, I thought I had it beat.
Turn out, after trying to implement data bindings on the business class object, problems re-emerged. To correct, I had to implement corrective code in the class date property constructor as follows. . .
Private _RevisionDate as Date
Public Property RevisionDate() as DateGet If _RevisionDate.Year=1 Then Return CDate(“1/1/1753”) Else Return _RevisionDate End IFEnd GetSet(ByVal value as Date) If value = CDate(“1/1/1753”) Then value = Nothing _RevisionDate = valueEnd SetEnd Property
Then, after setting the form data bindings on the controls to the business class object, I still had to force a Null value into the date control, like . . .
If CType(Me.RevisionDate.Value, Date) = CType("1/1/1753 12:00:00 AM", Date) Then _Me.RevisionDate.Value = Nothing
And the control is still not correct, as it does not allow the user to enter and then leave without setting a valid date value. So am I missing something here?
Regards,Rob
Hi Mike,
I kept getting the error " value cannot be set outside the range of the min/max value . . ." something like that. I found the problem was comming from the fact that the application is using business object class, where a null datetime property will carry a value of "1/1/001 12:00:00 AM" which, if I am not mistaken, is different the Infragistics minimum value for this datatype,
Anyway, I corrected the problem by putting a check for Year on in the code that loads the data into form controls.
If myClass.RevisionDate.Date.Year = 1 Then
myDateControl.Value=Nothing
Else
myDateControl.Value= MyClass.RevisionDate
End If
I could have put the code in the Class property declaration itself, but then the class cause problems elsewhere accross the solution.
Regards,
Hi Rob,
If Nullable is true, then the control should allow you to blank out the Value property. The DateTime property cannot be null, because it's of type DateTime, which is a struct and does not support nulls.