I selected the parent node (the top) in treeview. and now i need to add a new parent node to the existing parent node dynamicly. here is my way of solving to the problem: `
treeView1.SelectedNode.Parent.Nodes.Add(textBox1.Text.Trim());
//here comes an error of null reference argument
//To avoid that error,i tried it in this way:
if (treeView1.SelectedNode.Parent == null)
treeView1.SelectedNode.Parent=new TreeNode(textBox1.Text.Trim());
` But it still returns an error. Help me solve this. Thanks guys!