怎么获取dbgrideh选中列的值
展开全部
//列出DBGridEH被选中的值
procedure TForm1.N4Click(Sender: TObject);
Var
I:Integer;
begin
for I := 0 to DBGridEh4.SelectedRows.Count-1 do
begin
DBGridEh4.DataSource.DataSet.GotoBookmark(pointer(DBGridEh4.SelectedRows.Items[i]));
Memo1.Lines.Add(DBGridEh4.Fields[1].AsString);
End;
end;
扩展:
选中多行判断值,先做一个判断
首先要打开 dbgrideh属性 中的多重选择 options->dgmultiselect
procedure TForm3.N5Click(Sender: TObject);
var
i: Integer;
begin
if DBGridEh1.SelectedRows.Count>0 then
with DBGridEh1.DataSource.DataSet do
for i:=0 to DBGridEh1.SelectedRows.Count-1 do
begin
GotoBookmark(pointer(DBGridEh1.SelectedRows.Items[i]));
Listbox1.Items.Add(Fields[0].AsString);
end;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询