{
The code below creates a new case-insensitive index at runtime 
and then sorts the client dataset using that index. The user 
specifies the field on which to sort the client dataset in an edit control. 
} 
procedure TForm1.QuickIndexClick(Sender: TObject);
begin
  if Edit1.Text <> '' and 
     ClientDataSet1.Fields.FindField(Edit1.Text) then
  begin
    ClientDataSet1.AddIndex(Edit1.Text + 'Index', Edit1.Text, [ixCaseInsensitive],'','',0);
    ClientDataSet1.IndexName := Edit1.Text + 'Index';
  end;
end; 

