Folder browsing

J

Jonathan Dixon

I am using this code to get a list of folders and files

System.IO.DirectoryInfo didocs1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + jonn + "\\" + folder);



I was wondering if there was a way to determine if the the folder had any
files or subfolders within it or whether it is empty





Thanks



Jon
 
J

Jonathan Dixon

Sorry i did not explain properly

I am using the following code to bind a list of files to a datagrid but if
there are no folder of files the datagrid dissapears, i want a way to
check for files or folder before i bind the gird.

e.g

check for folder

if not folders, do nothing, if folders exist bind datagrid


System.IO.DirectoryInfo dicases1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + jon + "\\" + folder);

DataGrid3.DataSource = dicases1.GetFiles();

DataGrid3.DataBind();
 
E

Eliyahu Goldin

didocs1.GetFiles ();
didocs1.GetDirectories ();

Not sure about security issues.

Eliyahu
 
E

Eliyahu Goldin

Why not to read the list a files into an array and check the array size
before binding to it?

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top