我错误的地方的注释本来是一行的,发出来变成了两行。
错误在语句
FSourceQuery.Assign(Value);
错误信息为
[Error] MDStringGrid.pas(83): Undeclared identifier: 'FSourceQuery'
错误在语句
FSourceQuery.Assign(Value);
错误信息为
[Error] MDStringGrid.pas(83): Undeclared identifier: 'FSourceQuery'
我把控件加入FORM的时候,报错
错误信息的意思是:不能打开一个关闭的DATESET
我现在的目的是想做成象DbGrid的样子
是否我的参数里面不能直接用Query,而是要使用DateSource
我想参考一下DbGrid的做法
uses db;
procedure TMDStringGrid.SetSourceQuery (Value:TQuery);Cannot perform this operation on a close dateset的意思是你在对使用
dataset前要先openVCL源代码在delphi安装目录下的source\vcl中有
将procedure SetSourceQuery (Value:TQuery);
改成了procedure TMDStringGrid.SetSourceQuery (Value:TQuery);
然后在ColCount:=FSourceQuery.FieldCount;
RowCount:=FSourceQuery.RecordCount+1;
for i:=0 to ColCount-1 do
cells[0,i]:=FSourceQuery.Fields[i].DisplayName;
if FSourceQuery.RecordCount >0 then
begin
FSourceQuery.First;
i:=1;
while (i <= RowCount-1) and (not FSourceQuery.Eof) do
begin
for j:=0 to ColCount-1 do cells[i,j]:=FSourceQuery.Fields[j].AsString;
FSourceQuery.Next;
i:=i+1;
end;
前面加了一个判断if FSourceQuery.Active then
begin
...
...
end; 现在控件能加进去了
但是我还有一个问题,我想在创建StringGrid 的时候同时还创建按钮
FAddButton
但是我这样写
FAddButton:=TButton.Create(Parent);却实现不了
请再帮我看看好吗,分不够我还可以加
FAddButton.Parent:=Self;
这样可以吗?
那个Button只能放在StringGrid所在的区域里面
我想让他能够出现在Form里面,而不是限定在StringGrid里面。
我将FAddButton.Parent:=Self改成FAddButton.Parent:=Parent却不能显示我的这个Button了
能再帮我看看吗,谢谢