I know it is as simple as it is, I've search around the internet and I came up with nothing. Maybe I don't know what to search for.
Basically my datetimepicker format is set to year only.
My string is "2009"
I want the datetimepicker-year to set as the year in string
StrYear = "2007" Dim YearStart As Date = CType(StrYear , Date).Year DateTimePicker1.CustomFormat = "yyyy" DateTimePicker1.Value = YearStart
Error states that conversion of String "2007" to type Date is not valid