Please correct me and help me. This is the code.
option 1
Dim availability As New List(Of String)
If dtpavailability.Value = Date.Today Then availability.Add("Can start to work anytime") Else availability.Add("Can start to work by " dtpavailability.Value.Date)
Option 2
Dim availability As New List(Of String)
If dtpavailability.Value = Today Then availability.Add("Can start to work anytime") Else availability.Add("Can start to work by " dtpavailability.Value.Date)
Option 3
Dim availability As New List(Of String)
If dtpavailability.Value = TimeOfDay Then availability.Add("Can start to work anytime") Else availability.Add("Can start to work by " dtpavailability.Value.Date)
Output
Textbox1.text = String.Join(vbNewLine, availability)
I tried these options but I still can't achieve what I want for my practice project. I want the textbox1 to show the "Can start to work anytime" if I don't change the date on the date time picker which has the date today on my computer system.
Please help me correct my code.
CodePudding user response:
The DateTimePicker
includes the Time in the Value
Property.
To get only the date, you'll need:
dtpavailability.Value.Date