【发布时间】:2016-11-21 14:43:18
【问题描述】:
我有三个文件的记录:
type
TItem = record
Item : String;
Quantity: SmallInt;
Price : Currency;
end;
我还有将值设置为记录的程序:
function TForm1.SetItem(item:string;quan:SmallInt;price:Currency):TItem;
var It :TItem;
begin
It.Item :=item;
It.Quantity:= quan;
It.Price:=price;
Result :=It;
end;
现在,我需要一个将 record TItem 插入 TStringGrid 或 TGrid 的过程,但我不知道该怎么做。 我的 TStringGrid 中也有三列:
1. col_Item :string;
2. col_Quantity :SmallInt;
3. col_Price :Currency;
每次当我调用程序 SetItem 时,我都需要将记录中的三个字段插入到这三列中:
结果应该是这样的:
ITEM | Quantity | Price
Bread 1 1,5
Coca cola 1 3
Fanta 2 3
..等等。
【问题讨论】:
-
你的过程 SetItem() 没用。它创建一个 TItem 类型的记录,用值填充它,然后将其丢弃而不传回。
-
@GuidoG 我有更新问题。这是错误。你能帮我看看我需要什么吗?
-
Firemonkey 应用程序?
-
@LURD 是的......
标签: delphi firemonkey delphi-10.1-berlin