With custom DateTime Format, the DateTimePicker shows no reaction on clicking the spin buttons or pressing the Up-/Down keys. The manual entry of a value gets lost when the control loses focus, as reported in Issue 18624, (which was already fixed, but obviously for default format only).
__If additionaly, the Custom Format string is not set, the whole application crashes on any attempt to spin the value!__
Comments: ** Comment from web user: emartin **
__If additionaly, the Custom Format string is not set, the whole application crashes on any attempt to spin the value!__
Comments: ** Comment from web user: emartin **
Analysis:
DateTime.TryParse is used to do the parsing. This method does not support any format string as parameter. The actual code seems to "hack" the user input in order to have the "DateTime.TryParse" method succeed.
I have successfully parsed the faulty case using the DateTime.TryParseExact method, which accept a custom format string parameter, with the original user input.
Since the "hack" and TryParse algorithm seems complex and hard to grasp all the possible scenarios, I would suggest to fallback on the "DateTime.TryParseExact" only in the cases where the TryParse failed.