Solved

JAVIERTB   Please read this.

Posted on 1997-04-29
1
138 Views
Last Modified: 2010-04-04
Hello 'Javiertb',  Recently you replied to my question concerning how to handle an EConvert error from a TDateField, preferrably at the component level. I just want a simple way to clear the date field to '' on entry of an invalid date. Thank you for your reply but unfortunately it was erased by the Experts Exchange before I could read it, can you reply again please?
0
Comment
Question by:frog
1 Comment
 
LVL 2

Accepted Solution

by:
javiertb earned 50 total points
ID: 1335786
No problem, here you go:

You have to use the Fields Editor to access the TDateField events and then the code for the OnSetText is the following:

  // TDateField is Date1 and it has an edit mask !99/99/9999;1;_

  procedure TForm1.Table1Date1SetText(Sender: TField;
                                      const Text: string);
  begin
     try
          Table1Date1.AsDateTime:=StrtoDate(text);
     except

        // if date is left blank, don't show error message
        if (text<>' / / ') then
              ShowMessage('Date Error');

        // leave a blank date when error raised
        Table1Date1.AsString:='';
      end;
  end;

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now