title: VB.Net DateTimePicker NULL value
body: <p>I am using vb.net to load data from sql server database. One table has datatime column. I use bindingsource to bind controls to columns. This is how I bind datetimepicker to data column: </p>
  
  <pre><code> returnDateDateTimePicker.DataBindings.Add(New Binding("value", bsRegister, "returnDate"))
  </code></pre>
  
  <p>This date time picker has checkbox showed in it.</p>
  
  <p>When I open the form, if the column has datetime value not null or empty the data will be displayed properly and the checkbox will checked. </p>
  
  <p>Now when I want to set the return date as null to be saved to the database it does not save it as null!</p>
  
  <p>I tried working around with it as follows: </p>
  
  <pre><code>Private Sub ReturnDateDateTimePicker_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ReturnDateDateTimePicker.MouseUp
      Try
          If ReturnDateDateTimePicker.Checked = True Then
              ReturnDateDateTimePicker.CustomFormat = "dd-MMM-yyyy hh:mm tt"
          Else
              ReturnDateDateTimePicker.CustomFormat = "    -- 'Select Date' --  "
          End If
      Catch ex As Exception
          MsgBox(Err.Description)
      End Try
  End Sub
  </code></pre>
  
  <p>When I uncheck the datetimepicker text will be changed to  '--  Select Date --'.</p>
  
  <p>I thought this would solve the problem but returnDate always has a value!
  What is wrong with my code and whats the solution?</p>