Rotina para manipulaçao de Grids

Veja nesta dica uma rotina para excluir itens selecionados no Grid.

procedure TForm1.ExcluirItensSelecionadosGrid(Grid : TDBGrid);                            
var  i          : integer;                                                                 
Begin                                                                                     
    with Grid, Grid.datasource.dataset do                                                 
    begin                                                                                 
        DisableControls;                                                                  
        for i:= 0 to SelectedList.Count-1 do                                              
        begin                                                                             
          GotoBookmark(SelectedList.items[i]);                                            
          Freebookmark(SelectedList.items[i]);                                            
          Delete;                                                                         
        end;                                                                              
        SelectedList.clear;                                                               
        EnableControls;                                                                   
    end;                                                                                  
end;                                                                                      
                                                                                          
                                                                                          
//O Grid deve está sempre com a Propriedade Multiselect = True;                           
//EX:  GridD.Options := GridD.Options + [dgMultiSelect];