检查 cxDateEdit 是否以正确的格式输入

Check if cxDateEdit is entered in the right format

也许微不足道但是....您如何检查用户是否在 cxDateEdit 中写入了正确的日期(以正确的格式)?我知道他可以 select 用鼠标输入日期,但以防万一他试图手动输入日期,如果 he/she 写错日期,你如何纠正他的错误?

cxDateEdit 不会 post 无效日期。如果您对什么是有效日期有特殊要求,请使用 Properties.OnValidate 事件通过将错误变量设置为 true 来拒绝您不喜欢的日期;

How do you check if the user has written the right date (in the right format) inside the cxDateEdit?

没有必要:提供一个指定格式的字符串 TcxDateEdit.Properties.EditFormat 属性,输入必须匹配格式。

有关可用说明符的列表,请参阅 System.SysUtils.FormatDateTime#Description