Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomGridTableView.FindItemByName(string) Method

Locates an item with the specified name.

#Declaration

Delphi
function FindItemByName(const AName: string): TcxCustomGridTableItem;

#Parameters

Name Type
AName string

#Returns

Type
TcxCustomGridTableItem

#Remarks

Use this method to locate an item with the specified name within the View.Items collection. This can be useful when creating items and accessing them at runtime. Note that the search is case-sensitive.

The following code demonstrates Form.OnCreate and Button.OnClick event handlers. A column is created and set up in the Form.OnCreate event handler and in the Button.OnClick event handler this column is accessed by the FindItemByName method and its visibility is changed:

procedure TForm1.FormCreate(Sender: TObject);
var
  MyColumn: TcxGridDBColumn;
begin
  MyColumn := tvFilms.CreateColumn;
  MyColumn.Name := 'MyFavoriteColumn';
  MyColumn.DataBinding.FieldName := 'YEAR';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  tvFilms.FindItemByName('MyFavoriteColumn').Visible := not tvFilms.FindItemByName('MyFavoriteColumn').Visible;
end;
See Also