-2

how can i get access to a tree view ,which is placed in a tab contol
i used

treeView1.TopNode.Text=filename;

for setting the top node name. but it always shows an error like

"Object reference not set to an instance of an object"

can anyone help me

Microsoft DN
  • 9,292
  • 9
  • 49
  • 66

1 Answers1

0

Initialize it with treeView1 = new TreeView() and then add elements - you are tyring to set a text of a non-existing element.

See http://www.codeproject.com/Articles/26288/Simplifying-the-WPF-TreeView-by-Using-the-ViewMode for example.

nxu
  • 2,156
  • 1
  • 22
  • 34