Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EConvertError

0 views
Skip to first unread message

Chuck Samuels

unread,
Feb 2, 2007, 2:06:26 PM2/2/07
to
Hi,
I am assigning a date time from an editbox to a TDateTime object (timex =
StrToDateTime(Edit4->Text)) and if the operator makes an error I want to
catch the error. Can someone tell me how to use Try and Catch to do this.
No matter what I do, the catch does not work and I get an EConvertError that
screws up the program.
Thanks
Chuck


Remy Lebeau (TeamB)

unread,
Feb 2, 2007, 2:39:52 PM2/2/07
to

"Chuck Samuels" <ch...@fairweather.com> wrote in message
news:45c3...@newsgroups.borland.com...

> I am assigning a date time from an editbox to a TDateTime object

I would suggest using a TDateTimePicker instead.

> if the operator makes an error I want to catch the error. Can
someone
> tell me how to use Try and Catch to do this.

The same way you use try..catch for any other kind of exception:

try
{
timex = StrToDateTime(Edit4->Text);
}
catch(const EConvertError &)
{
// do something ...
}

Or:

try
{
timex = StrToDateTime(Edit4->Text);
}
catch(const Exception &)
{
// do something ...
}

> No matter what I do, the catch does not work

Yes, it does.


Gambit


0 new messages