Hi all,
In VB.NET how to find how many files are there in a folder.
Can anyone help me in this regards
Thanks in advance.
Regards
Nag K.
Printable View
Hi all,
In VB.NET how to find how many files are there in a folder.
Can anyone help me in this regards
Thanks in advance.
Regards
Nag K.
Sure can, it's very easy. First you have to add this to the top of the form.
VB Code:
Imports System.IO
Then create a new DirectoryInfo variable like the following:
VB Code:
Dim DirInfo as New DirectoryInfo([i]folderpath[/i])
Substitute folderpath with the path of the folder you wish to find out how many files there are.
Then use the following code to get the number of files in the folder:
VB Code:
[i]variable[/i] = DirInfo.GetFiles().GetUpperBound(0)
Hope this helps.
Oooo, this was my 400th post, yey :bigyello:.