procedure TFmCtrlGrid.FormShow(Sender: TObject);
begin
DM1.CalculateTotals(Sender, nil);
end;
是Demos\DB\CtrlGrid例子里的
begin
DM1.CalculateTotals(Sender, nil);
end;
是Demos\DB\CtrlGrid例子里的
解决方案 »
- DELPHI中如何删除一个表的所有数据啊?
- 怎样把exe文件放到数据库中,从数据库中读取文件并保存为exe文件
- 送分!!!请大家帮忙 急!!!!!
- 求delphi6的下载
- 怎样把时间2003年12月12日12时30分存入数据库?
- 谁有Jeffrey Richter的《windows核心编程》书附带光盘原码!
- 怎么用insert语句?(我的 ADOQuery返回值是空的)在线等待。
- 有人知道这是怎么回事吗?
- 请教一个问题,我如何使用ISHellUIHelper接口?要加什么头文件?为什么它说我没有注册类别?
- 求Delphi高手帮忙
- 哪位有这种工具...
- onEnter事件是什么意思?在什么情况下触发的啊?
全文查询下CalculateTotals
var
flTotalCost, { Holds total share cost }
flTotalShares, { Holds total share count }
flTotalValue, { Holds total share value }
flDifference: Real; { Holds difference between cost and value }
strFormatSpec: string; { The Display Format specification }
begin { Update the count of stock transactions }
FmCtrlGrid.lPurchase.Caption := IntToStr( tblHoldings.RecordCount ); { See whether or not its necessary to total the holdings and
(if so) do so and update the result displays; otherwise,
clear the result displays. }
if tblHoldings.recordCount = 0 then
begin
{ Clear the result displays }
FmCtrlGrid.lTotalCost.Caption := '';
FmCtrlGrid.lTotalShares.Caption := '';
FmCtrlGrid.lDifference.Caption := '';
end
else
begin
{ let the user know something's going on }
Screen.Cursor := crHourglass; { Initialize the holder variables }
flTotalCost := 0.0;
flTotalShares := 0.0; { Calculate the total cost of these holdings. }
tblHoldings.disableControls; { hide this process from the user }
tblHoldings.first;
while not tblHoldings.eof do
begin
flTotalCost := flTotalCost + tblHoldingsPUR_COST.AsFloat;
flTotalShares := flTotalShares + tblHoldingsSHARES.AsFloat;
tblHoldings.next;
end;
tblHoldings.first;
tblHoldings.enableControls; { restore the display of holdings } { Calculate the current value of the shares (by multiplying
the current holdings by the current share price) and the
difference between the cost and the value. } flTotalValue := flTotalShares * tblMasterCUR_PRICE.AsFloat;
flDifference := flTotalValue - flTotalCost; { Use the same format specification as that being used to
display the Current Price field value so it can be used
to display the results } strFormatSpec := tblMasterCUR_PRICE.DisplayFormat; { Update the result displays } FmCtrlGrid.lTotalCost.Caption :=
FormatFloat( strFormatSpec, flTotalCost );
FmCtrlGrid.lTotalShares.Caption :=
FormatFloat( strFormatSpec, flTotalValue );
FmCtrlGrid.lDifference.Caption :=
FormatFloat( strFormatSpec, flDifference ); { Update the Font Color of the Diference to
indicate the quality of the investment }
if flDifference > 0 then
FmCtrlGrid.lDifference.Font.Color := clGreen
else
FmCtrlGrid.lDifference.Font.Color := clRed;
FmCtrlGrid.lDifference.update; { let the user know that we're finished }
Screen.Cursor := crDefault;
end;
end;什么功能自己看下
妈的,这个例子的名字起的n怪,
窗体的name是ctrlGrid,
我看来看去,窗体上只有一个ctrlGrid,害的我找了半夜,
日~!