delphi中如何删除stringgrid中的某行数据
解决方案 »
- 我想买个1千左右的诺基亚手机 ,哪款好呀,求解!!!
- 关于EXCEL操作的问题
- 谁能告诉我如何显示日历
- 如何册除,注册的自定义控件
- 请问怎么动态创建image啊
- listbox自动换行,换行后,做为一整行,急急急!!!
- delphi与JSP通过HTTP传输XML来进行数据库的更新和调用
- 啊呀呀,偶差点忘了,老瓦会pb,还有哪位师父会pb?偶要学习pb了//牛虻
- 请问time string 转换成systemtime 如何转换?
- #0是什么?if not(key in['0'..'9',#8]) then key:=#0;这边的#0是?
- 请问如果用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就可以删除当前行了.