delphi中如何删除stringgrid中的某行数据
解决方案 »
- 数据值24位数据没法赋值到类型int64的变量 请教如何处理
- 如何获得count返回值
- 请问如何在Delphi7中加入QuickReport打印控件??
- 冰天雪地赤身裸体720度超難度轉身跪求 查找最大记录的SQL语句写法.......................
- 汉字比较的问题
- 请大家帮帮忙解决这个问题(急),跟贴有分
- 在delphi中如何访问共享目录???
- DBGrid如何显示88.88%这种格式?或者ADOQuery如何(动态)控制字段格式?
- 300分求交换机计费软件源程序。收到后将继续加分。
- 取系统时间问题:
- 请问如果用ListView或StringGrid显示大量数据,会不会很慢啊?
- 如何将array of byte类型的数组转换成字符串?(在线)
krow:integer;stringgrid1.onselectcell()
begin
krow:=arow;
end;var
i:integer;
begin
for i:=0 to stringgrid1.colcount-1 do
stringgrid1.cells[i,krow]:=''
end;
procedure TfrmEmployEdit.btnDelClick(Sender: TObject); //删除
var
i, n : Integer;
strID : string;
temp : Pchar;
begin
inherited;
temp := pchar('您是否确定要删除编号为【'+StrGridDate.Cells[1, StrGridDate.Row]+ '】的巡检员?'); if messagebox(self.Handle, temp, '警告',MB_yesno or MB_ICONQUESTION )=IDyes then
begin
StrID := StrGridDate.Cells[1, StrGridDate.Row];
for i:= StrGridDate.row to StrGridDate.RowCount do
for n:=1 to 10 do
StrGridDate.Cells[n,i] := StrGridDate.Cells[n, i+1];
StrGridDate.RowCount:= StrGridDate.RowCount - 1; for i:=1 to StrGridDate.RowCount-1 do
StrGridDate.Cells[0,i] := IntToStr(i);//这只是删除表面的 with QryMain do
try
begin
Clear;
Add('delete from xg_Employ where EmpNo = '''+StrID+'''');
ExecSQL;
Close;
end;
except
on E : Exception do
begin
MessageDlg(E.Message , mtError, [mbOK], 0);
end;
end;
intCount := IntCount - 1;
LCount.Caption := '共有巡检员记录 :'+''+IntToStr(intCount)+''+'条';
end;
end;
public
procedure DeleteRow(Arow:Integer);override;
end;在implementation部分加上procedure TmyStringGrid.DeleteRow(Arow:Integer);
begin
inherited;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
TmyStringGrid(StringGrid1).DeleteRow(StringGrid1.Row);
end;这样点击Button2就可以删除当前行了.