-1

in my application when converting text to float / integer / date values and assign it to table component i get one message box "You have inserted an invalid value".

my actual code like

Table1.Fieldbyname('XXX').value := strtofloat(Quantity.Text); 

here xxx is float data type, and passing values like (5---6)

(or)

Table1.Fieldbyname('XXX').value := inttostr(Quantity.Text);

here xxx is integer data type, and passing values like (3+)

(or)

Table1.Fieldbyname('XXX').value := strtodatetime(Quantity.Text);

here xxx is date data type, and passing values like (13/ss).

am not validate anything on edit box on exit event,

my question is, am using eureka-log to catch exception, but these messages are not catch up by eureka-log. these messages are raised as exception or its just warning message?

if it is exception how to handle in eureka-log?

TLama
  • 75,147
  • 17
  • 214
  • 392
bejarun
  • 175
  • 3
  • 11
  • 7
    `IntToStr(Quantity.Text)` is not your actual code, is it? – LU RD Sep 03 '14 at 04:25
  • Please give verbatim error messages, maybe screenshot. Perhaps you should do some debugging too. – David Heffernan Sep 03 '14 at 05:57
  • 2
    Eureka can only catch uncaught exceptions. Most exceptions raised in the main thread, especially in event handlers, are caught by the RTL to display a popup message. – Remy Lebeau Sep 03 '14 at 06:56
  • 4
    You might do better to consider why you get the error messages in the first place. You should avoid assignments to .Value, use AsFloat, AsInteger, AsString, AsDateTime etc instead. Btw, what do you mean by e.g. "(5---6)"? – MartynA Sep 03 '14 at 08:37
  • 1
    If those are the literal values passed, e.g. `'(3+)'`, etc. then it is no wonder that it doesn't work properly. – Rudy Velthuis Sep 03 '14 at 09:36
  • Assinging strings to dates can give errors if you don't have the correct driver – r_j Sep 04 '14 at 12:58
  • Is your issue the errors or the fact that Eurekolog does not catch them? Please edit your question (especially the title) to make that clear – Jan Doggen Sep 04 '14 at 13:04

2 Answers2

0

if

... inttostr(Quantity.Text);

is not a typo then it is your problem, try

.... strtoint(Quantity.Text);
fuchs777
  • 993
  • 1
  • 14
  • 30
-1

In the place in your actual code where you have

Table1.Fieldbyname('XXX').value := strtofloat(Quantity.Text);

calculate the value (or, one of the values) that you expect to get from strtofloat(Quantity.Text) and replace the function with the literal value. For example:

Table1.Fieldbyname('XXX').value := 5.6;

If the execution of this line produces the same error, then you know the problem is with the Fieldbyname() assignment.

If the execution of this line does not produce the same error, then you know you are not getting what you expect from strtofloat(Quantity.Text).

A. I. Breveleri
  • 747
  • 5
  • 6