S
S
Sergey Khlopov2017-10-27 10:44:41
Programming
Sergey Khlopov, 2017-10-27 10:44:41

How to add objects one by one to TreeView?

Hello, please tell me, there is a collection with objects through which I go through a loop. And the conditions by which I find out I need an object. That is, if the name of the selected button is equal to the name of the object in the collection, then the found object is responsible for this button. So I did these steps twice, found two objects. Now that I have found two objects, form2 should open and the second form has two TreeViews. Actually the question is how to add my two objects to these TreeView at the same time. That is, the question is not how to add object fields to TreeView, but how easy it is to make it so that we can (object No. 1 got into TreeView No. 1 and object No. 2 got into TreeView No. 2)
59f2e0b977adf131888772.jpeg

for(int i = 0; i < Array_Object_Link.Count; i++)
{
if(btnTemp.Text == Array_Object_Link[i].nameObj)
     {
     //Нужно добавить выбранный объект в f2.TreeView1 и f2.TreeView2
     }
 }

form2
59f2df28dbfec039993764.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
heartdevil, 2017-10-27
@heartdevil

Maybe so?
f2.treeView1.Nodes.Add(Array_Object_Link[i]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question