I created a navigation bar.Now i need to add Mycomputer as the root location of the navigation bar and i also need the sub directories
I am new to this infragistic control
My code is as below
{
// The text that WinNavigationBar will use when parsing
// the full path of a child location (or itself).
}
// Populate an array of DirectoryInfos with the
// subdirectories of the parent location's path.
// Loop through each subdirectory...
// ...add a new location to WinNavigationBar.
// The subdirectory's full path will be the key
// and the name will be the Text.
e.ParentLocation.Locations.Add(dir.FullName, dir.Name);
// Get the files associated with the selected location.
// Clear the previous location’s items from WinListView
UltraListViewItem item = null;
// Populate WinListView with folders and files.
item.Tag = dir;
// At this point, you can assign an image
// to the folder items with a line of code
// similar to the following...
//item.Appearance.Image = this.imageListLarge.Images[0];
item.Tag = file;
DirectoryInfo[ dirs = new DirectoryInfo(e.ParentLocation.GetFullPath(FullPathFormat.EditMode) + "\\Anil\\").GetDirectories();
as Could not find a part of the path 'C:\Users\Anil\Documents\Visual Studio 2008\Projects\NavigationBarusingInfragistic\NavigationBarusingInfragistic\bin\Debug\C\Anil'.
what modification should i do with the code
Please help me
1) This line of code: this.ultraNavigationBar1.RootLocation.Text = "C";should be changed to: this.ultraNavigationBar1.RootLocation.Text = "C:";
2) This line of code: DirectoryInfo[ dirs = new DirectoryInfo(e.ParentLocation.GetFullPath(FullPathFormat.EditMode) + "\\Anil\\").GetDirectories();should be changed to: DirectoryInfo[ dirs = new DirectoryInfo(e.ParentLocation.GetFullPath(FullPathFormat.EditMode)).GetDirectories();
Thanks alot for your quick respose .The error is resolved !!
Now my problem is I am not able to get the some of the child location
DirectoryInfo[ dirs = new DirectoryInfo(path + "\\").GetDirectories();
what is wrong with tha code
There is nothing wrong with the code, your user account doesn't have the necessary permissions on that directory.