I am trying to set up a date range filter on my UI, with checkboxes to say whether a DateTimePicker\'s value should be used, e.g.
Dim fromDate As DateTime? =
In addition to @Damien_The_Unbeliever's fine answer, using New DateTime? also works:
New DateTime?
Dim fromDate As DateTime? = If(fromDatePicker.Checked, _ fromDatePicker.Value, _ New DateTime?)
You might find that it looks a bit counter intuitive, why perhaps the CType(Nothing, DateTime?) is preferable.
CType(Nothing, DateTime?)