dimanche 19 avril 2015

set Check to treeView checkbox

I have a TreeView that each item has a different code.

User can check 5 items and save them. Then I have a list of treeView's nodes code.

I want to show the checked items in form load to the user. But my code doesn't work. can anybody help me?


This is my code :



private void chechTreeViewItems(List<int> remID)
{
foreach ( System.Windows.Forms.TreeNode item in this.tvRemark.Nodes)
{
for (int i = 0; i < remID.Count; i++)
{
if (Convert.ToInt16(item.Tag)== remID[i])
{
item.Checked = true;
}
}

}

}


I think this code can't trace child nodes.


Aucun commentaire:

Enregistrer un commentaire