CSDN博客

img hoge66

在DBGrid中计算两个字段值的乘积!

发表于2004/7/2 11:24:00  1265人阅读

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('请将数据填写完整!');
 exit;
 end;
 end;
end;
end;
0 0

相关博文

我的热门文章

img
取 消
img