Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Invalid date dialog
Fri, Dec 18 2015 7:41 AMPermanent Link

Ronald

Hi,

I am using a ctDateEditComboBox in a TGrid. If I enter an invalid date an error is raised and I get the message: "Invalid date" and the linenumber. But I want to use the BeforeSave event to validate the date myself (that works fine), but before the BeforeSave event is triggered called an error is raised and a standard dialog box appears.
How can I prevent this?

Greetings,
Ronald
Fri, Dec 18 2015 9:39 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ronald,

<< I am using a ctDateEditComboBox in a TGrid. If I enter an invalid date an error is raised and I get the message: "Invalid date" and the linenumber. But I want to use the BeforeSave event to validate the date myself (that works fine), but before the BeforeSave event is triggered called an error is raised and a standard dialog box appears.  How can I prevent this? >>

As you found out, the date column in the dataset will have its value assigned before the BeforeSave event is fired.  The error is occurring when the date column tries to convert the invalid date string to an actual date value.

You'll need to use an OnSetText event handler for the dataset column that contains the date in order to intercept the invalid date assignment and raise your own error, etc.

Tim Young
Elevate Software
www.elevatesoft.com
Image