dimanche 19 avril 2015

set Check to treeView checkbox

Hello to all StackOverFlow friends, I have a TreeView that each item has a different code. User can check 5 item and save it . then I have a list of treeView's nodes code. I want to show the checked item 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