I want to assign the DOB variable as null.
Dim DOB As Date = DTPSdob.Value
Dim datestring As String = DOB.ToString("d")
If chkSdob.Checked = False Then
DOB = 'I want to assign here DOB variable as null'
Else
DOB = datestring
End If
Use nullable datetime
Dim DOB As Nullable(Of Date) = Date.Now
Dim datestring As String = DOB.Value.ToString("d")
DOB = Nothing
“DateTime is a value type (a structure) and can not be set to null or nothing as with all .Net value types. The default value for a datetime value is zeros for the date portion and 12:00:00 AM for the Time portion.”
Change the DOB from a date variable to an object variable. You can then pass nothing or a valid date into the variable. That variable can then be used update the database.
dim DOB as object = nothing
If chkSdob.Checked = True Then
DOB = datestring
end if