Well, you are getting error 1 because you are passing a treenode parameter to a sub that is expecting a treeview. Pass trdDirectory, not trdDirectory.Nodes(0).

You are getting error 2 because, well obviously, directoryArray is not declared, just like the error is telling you. I don't know what directoryArray is supposed to be from your current code, it is only reference in the one line.