Re: Treeview.Tag property
Your thread title says "TreeView.Tag property", not "TreeNode.Tag property". Are you sure that you're assigning the GUID to the node's Tag property in the first place and not the tree's Tag property? Your error message indicates that that is a possibility.
Re: Treeview.Tag property
I think you may have it there John. If the error says "Object not set to instance blah..." then you need to either step through your code looking to see if its going through your code to set the nodes tag property or place a breakpoint on the code that is setting the nodes tag property and see if it gets executed.
Re: Treeview.Tag property
Thanks for the quick reply
what im doing is
node = treeConsumers.Nodes.Add("ID's");
foreach (DataRow dr in dtExport.Rows)
{
node.Nodes.Add(dr["Last_Name"].ToString().Trim()
node.Tag = dr["UserGUID"]
}
I guess that would set the Tag to the parent node. How do I set it on the child nodes then??
Re: Treeview.Tag property
As you can see from your first line, the Add method returns a reference to the node you just added. That means that in the loop the Add method will return a reference to the child node you just added, so you can set its Tag directly:
Code:
node.Nodes.Add(dr["Last_Name"].ToString().Trim()).Tag = dr["UserGUID"];