Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Multi-selection in DBGrid
Set dgMultiSelect option of DBGrid to true and put next code to the Button.OnClick event:
procedure TForm1.Button1Click(Sender: TObject);
var
X: Word;
TempBookmark: TBookMark;
begin
with DBGrid1.DataSource.DataSet do
begin
DisableControls;
with DBGrid1.SelectedRows do
if Count<>0 then
begin
TempBookmark:=GetBookmark;
for X:=0 to Count-1 do
begin
if IndexOf(Items[X])>-1 then
begin
Bookmark:=Items[X];
ShowMessage(Fields[1].AsString);
end;
end;
end;
GotoBookmark(TempBookmark);
FreeBookmark(TempBookmark);
EnableControls;
end;
end;
-
More for developers