SimonYu
asked on
TreeView item search
How to find a item in a TreeView component and expand the node?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'1234' is your wanted selected node's Text
ASKER
But how can I expand the selected item node only?
try follow:
procedure TForm1.Button1Click(Sender : TObject);
var
i:integer;
begin
for i:=0 to TreeView1.Items.Count-1 do
if TreeView1.Items[i].Text='1 234' then
begin
TreeView1.Items[i].Selecte d:=True;
break;
end;
end;
procedure TForm1.Button1Click(Sender
var
i:integer;
begin
for i:=0 to TreeView1.Items.Count-1 do
if TreeView1.Items[i].Text='1
begin
TreeView1.Items[i].Selecte
break;
end;
end;