B
Brian
I'm reasonably new to C#, and using a class containing a hashtable
collection to feed a treeview. My problem is that I can't pull the
data from the hashtable!
Here's the code I have:
if (myItem.DataFields.Count != 0)
foreach (string name in myItem.DataFields.Values) {
treeView1.SelectedNode.Nodes.Add (name); // Error on this line
}
myItem is an instance of my class, DataFields is the hashtable, and
you can see I'm trying to access the column containing values. I get
a 'System.NullReferenceException' at runtime.
Can someone help? Am I approaching this whole thing wrong?
Thanks,
Brian
collection to feed a treeview. My problem is that I can't pull the
data from the hashtable!
Here's the code I have:
if (myItem.DataFields.Count != 0)
foreach (string name in myItem.DataFields.Values) {
treeView1.SelectedNode.Nodes.Add (name); // Error on this line
}
myItem is an instance of my class, DataFields is the hashtable, and
you can see I'm trying to access the column containing values. I get
a 'System.NullReferenceException' at runtime.
Can someone help? Am I approaching this whole thing wrong?
Thanks,
Brian