Calculate the product of two field values ​​in DBGRID!

zhaozj2021-02-16  50

procedure Tfrmfy.DBGridEh4KeyPress (Sender: TObject; var Key: Char); var strziduan1, strziduan2: string; begin if key = # 13 then begin Flatbutton5.Click; if (DBGridEh4.SelectedField.FieldName = 'xc_cishu') or (DBGridEh4. SelectedField.FieldName = 'xc_danjia') then begin try strziduan1: = DBGridEh4.DataSource.DataSet.FieldValues ​​[ 'xc_cishu']; strziduan2: = DBGridEh4.DataSource.DataSet.FieldValues ​​[ 'xc_danjia']; DBGridEh4.DataSource.DataSet.FieldValues ['XC_HEJI']: = floattostr (STRTOINT (STRZIDUAN1) * STRTOFLOAT (STRZIDUAN2))); Except ShowMessage ('Please fill in the data!'); End; end; end;

转载请注明原文地址:https://www.9cbs.com/read-18122.html

New Post(0)