Mega Code Archive

 
Categories / Delphi / ADO Database
 

Multi selection in DBGrid

Title: 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&lt&gt0 then begin TempBookmark:=GetBookmark; for X:=0 to Count-1 do begin if IndexOf(Items[X])&gt-1 then begin Bookmark:=Items[X]; ShowMessage(Fields[1].AsString); end; end; end; GotoBookmark(TempBookmark); FreeBookmark(TempBookmark); EnableControls; end; end;