by "Stark" <franco.jommi@[EMAIL PROTECTED]
>
Apr 3, 2008 at 02:39 PM
But the value typed into the DBGrid cell is not written into the dataset
field up to a Post statement as far as I understand.
If ItemsQty is the dataset field, isn't the validation control executed
too
late ?
I am going to look into the example you mentioned... Thanks anyway.
"sap" <sap@[EMAIL PROTECTED]
> ha scritto nel messaggio
news:ft1513$bok$1@[EMAIL PROTECTED]
> "Stark" <franco.jommi@[EMAIL PROTECTED]
> wrote in message
> news:47f40918$0$36440$4fafbaef@[EMAIL PROTECTED]
>> How do I identify what digitized by the user into a DBGrid cell ( in
>> order
>> to validate it before it is written to the dataset) ?
>> I tried different statements (DBGrid1.Fields[4].Value etc. ), but
didn't
>> find the right one. Can anyone help ?
>
> You never validate DbGrid cell contents, but the Field content you are
> going
> to write to the database.
>
> Let's say in your ITEMS.DB table you have field 'Qty', and you view that
> table content through a TTable or TQuery components that are again
linked
> to
> TDbGrid control.
>
> Then you would use one of those *events* that TTable or TQuery
generously
> offer for each of the underlying database fields.
>
> procedure TForm1.ItemsQtyValidate(Sender: TField); // ItemsQty field
> validation.
> begin
> if ItemsQty.Value < 1 then
> raise Exception.Create('Must specify quantity');
> end;
>
> You better locate the MastApp demo from the delphi \DEMOS sub directory,
> and
> start to investigate that.
>
> You'll find the similar code snippet like above from the DATAMOD.PAS
unit.
>
> -sap
>
>