title: DateTimePicker validation
body: <p>I want to validate the DateTimePicker control in vb.net. I am using it for date of joining for the employee so i dont want the control to allow selection of future dates..only dates till the current date can be allowed to select. I have tried the following code: </p>
  
  <pre><code>Private Sub DateTimePickerDOJ_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePickerDOJ.ValueChanged
  
      If DateTimePickerDOJ.Value &gt; Date.Today Then
          MessageBox.Show("You Cannot Select a Future Date!", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
      End If
  End Sub
  </code></pre>
  
  <p>The above code only displays the message correctly but its of no use becoz the future date is getting selected.</p>
  
  <p>can anyone please help me out with dis problem?</p>