This is a WinForms, VB.NET app, using VS 2010 Pro. I added a datetimepicker to a form. Set the custom property to MM/dd/yyy. the relevant part of my function is as below:
If IsDate(_uni.unitRentDate) Then
t_TenantUnitRentDate.Value = _uni.unitRentDate
Else
If Not _uni.unitRentDate.HasValue Then
t_TenantUnitRentDate.Value = New DateTime(2010, 1, 1)
End If
End If
_uni is a table in the EF and unitRentDate is stored in that table as DATETIME. The datetimepicker is t_TenantUnitRentDate.
The problem I am having is that when the form loads the dateTimePicker is showing the date in the format of this example Saturday , September 10, 2012 . This is not what I am wanting it to do at all.. It should be showing as 9/10/2012 . Why is this failing I looked at the date being returned from the database and it is showing a correct date value at that time.
Try it again by setting Format property to ‘Custom’