```
 Dim dtIzvrsenja datetime
Private Sub chkDate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDate.CheckedChanged
        If Me.chkDate.Checked Then
            Me.dtpDate.CustomFormat = "dd.MM.yyyy"
            Me.dtpDate.Enabled = True
            dtIzvrsenja = dtpdate.value
        Else
            Me.dtpDate.CustomFormat = " "
            Me.dtpDate.Enabled = False
            dtIzvrsenja = Nothing
        End If
    End Sub

```

Is there any way to set the value of dtIzvrsenja to null if chk is not checked ?

Edit by using the way other mentioned.

> 
> {"Nullable object must have a value."}
> 
> 
> 

```
  Dim dtIzvrsenja2 As DateTime? = Nothing
            dtIzvrsenja = dtIzvrsenja2

```