I stored a date value and retrieve it and the format of the date in the string is yyMMdd
.
Now when the user loads that from the string i would like to select the DateTimePicker as the user loaded date.
Sample code:
string strDate = strRead.Substring(23, 6);
DateTime dt = DateTime.Parse(strDate);
Can any one give me an idea for the next?
The most efficient way, I guess:
DateTimePicker p = new DateTimePicker();
DateTime result;
if (DateTime.TryParseExact("101025", "yyMMdd", CultureInfo.CurrentCulture, DateTimeStyles.None, out result))
{
p.Value = result;
}