0
As you are calling method after Initialzing components, you can pass this.treeview1 as first argument.
- ListDirectory(this.treeView1,"D:\\");
0
please Look at this i hope it Will help you
http://stackoverflow.com/questions/18024240/call-a-method-on-page-load
0
Based on your code, both the parameters for ListDirectory method are require.
- private void ListDirectory(TreeView treeView, string path)
- {
- ...
- }
Look like the TreeView control name is treeView1, you can modify the ListDirectory method to
- private void ListDirectory(string path)
- {
- ...
- }
Then on the TreeViewDemo()
-
- public TreeViewDemo()
- {
- ListDirectory ("D:\\");
- }
Regarding the TreeView, look like the code is working fine, it displaying both folders and files. Did you click on the + sign to expand the folder?
0
I am not undertsanding. if you have time please send me the code(I should be Execute). I want both directory and files.
0
Actully i want to display the files also, but it is only displaying folders in Treeview
0
Getting Error: Error 1 Optional parameters must appear after all required parameters
0
I dont know what sould i pass the value to the first argument
0
May i know what error you are getting?
-1
Try out this also.
http://stackoverflow.com/questions/35159549/how-to-display-all-files-under-folders-in-treeview