goEditing Users can edit the contents of cells. When goEditing is included in Options, goRangeSelect has no effect.
把StringGrid控件的Option属性中的goEditing设置为True就可以了
把StringGrid控件的Option属性中的goEditing设置为True就可以了
ARow: Integer; var CanSelect: Boolean);
begin
StringGrid1.Cells[ACol,ARow] := 'Macau '+IntToStr(ACol)+'-'+IntToStr(ARow);
end;
其实问题是这样的,我用delphi编oracle数据库的程序,代码如下:
procedure TForm1.StringGrid1DblClick(Sender: TObject);
var
i,j,k:integer;
begin
i:=stringgrid1.Col;
j:=stringgrid1.Row;
with table1 do
begin
open;
edit;
first;
for k:=0 to j-2 do
begin
if not eof
then
next;
end;
while not eof do
begin
fieldbyname('A').asstring:=stringgrid1.Cells[0,j];
fieldbyname('B').asstring:=stringgrid1.Cells[1,j];
fieldbyname('C').asstring:=stringgrid1.Cells[2,j];
fieldbyname('D').asstring:=stringgrid1.Cells[3,j];
end;
post;
close;
end;
end;
StringGrid1DblClick实现修改的功能。
也就是当双击了cell[i,j]时,就把修改了的内容写回大数据库,可报错误如下:
table1 dataset not in edit or insert mode
可是在程序里我有写“edit”命令啊!
不知何解?
请指教!
while not eof do
begin
fieldbyname('A').asstring:=stringgrid1.Cells[0,j];
fieldbyname('B').asstring:=stringgrid1.Cells[1,j];
fieldbyname('C').asstring:=stringgrid1.Cells[2,j];
fieldbyname('D').asstring:=stringgrid1.Cells[3,j];
end;
比如我想指向strgrid.Row条记录!
但一时想不起是哪天函数了,
请指教!