我试图这样做:
If DateTimePicker1.Value.Date = DateTimePicker1.Value.Date Then
MessageBox.Show("You have not entered a date of birth yet.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
虽然我的DateTimePicker值为2016-01-01
,但在通过所有验证检查时,即使我更改了日期的值,上面的错误仍会显示。
这是怎么发生的?
答案 0 :(得分:1)
If DateTimePicker1.Value.Date = New Date(2016, 1, 1) Then
MessageBox.Show("You have not entered a date of birth yet.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If