Peter Kiers
asked on
adding a node to the selected node of a treeview
Hi,
I have this:
But i get the errors at line 7:
->The best overloaded method match for 'System.Windows.Forms.Tree NodeCollec tion.Add(s tring, string)' has some invalid arguments
->Argument 1: cannot convert from 'System.Windows.Forms.Tree Node' to 'string'
Who can help me?
P
I have this:
But i get the errors at line 7:
->The best overloaded method match for 'System.Windows.Forms.Tree
->Argument 1: cannot convert from 'System.Windows.Forms.Tree
Who can help me?
P
string NewText = "";
if (InputBox.Show("New Folder", "Folder Name", ref NewText, validation) == DialogResult.OK)
{
TreeNode n = new TreeNode();
// MessageBox.Show(NewText);
TreeNode n2 = tvNotes.SelectedNode;
n.Nodes.Add(n2, NewText);
}
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I have this now, its error free but it does not work:
string NewText = "";
if (InputBox.Show("New Folder", "Folder Name", ref NewText, validation) == DialogResult.OK)
{
TreeNode n = new TreeNode();
TreeNode n2 = tvNotes.SelectedNode;
n.Nodes.Add(n2.Text, NewText);
}
Do you know perhaps why?
p.
string NewText = "";
if (InputBox.Show("New Folder", "Folder Name", ref NewText, validation) == DialogResult.OK)
{
TreeNode n = new TreeNode();
TreeNode n2 = tvNotes.SelectedNode;
n.Nodes.Add(n2.Text, NewText);
}
Do you know perhaps why?
p.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Oke thanx.
n.Nodes.Add(n2.ToString(),
or
n.Nodes.Add(Convert.ToStri
or
n.Nodes.Add(n2.Text, NewText);