0
트리 뷰에서 상위 노드 (맨 위)를 선택했습니다. 이제는 새 부모 노드를 동적으로 기존 부모 노드에 추가해야합니다. 여기에 문제 해결의 길입니다 : `기존 트리 뷰의 상위 노드에 새 루트 노드 추가
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());
` 하지만 여전히 오류를 반환합니다. 이 문제를 해결하도록 도와주세요. 감사합니다.