| | |
c# to VB.Net
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hi Guys,
Im more familiar with coding in C# ... can someone please help me to convert the line highlighted below into VB.NET
Much appreciated
Im more familiar with coding in C# ... can someone please help me to convert the line highlighted below into VB.NET
Much appreciated
private int file_count = 0;
///
/// Get the file count of a given directory recursively.
///
public void GetDirectoryFileCount(string dir)
{
dir = dir + @”\”;
//get all the directories and files inside a directory
String[] all_files=Directory.GetFileSystemEntries(dir);
//loop through all items
foreach(string file in all_files)
{
//check to see if the file is a directory if not increment the count
if(Directory.Exists(file))
{
//recursive call
GetDirectoryFileCount(file);
}
else
{
//increment file count
file_count++;
}
}
} Michelle (Junior Developer)
That's your codes or get from internet?
vbnet Syntax (Toggle Plain Text)
Private file_count As Integer = 0 Public Sub GetDirectoryFileCount(ByVal dir As String) dir = dir & ”\” Dim all_files() As String=Directory.GetFileSystemEntries(dir) For Each file As String In all_files If Directory.Exists(file) Then GetDirectoryFileCount(file) Else file_count += 1 End If Next file End Sub
Last edited by Jx_Man; Sep 22nd, 2008 at 12:43 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Similar Threads
- Freelance .NET / MS SQL developer (Web Development Job Offers)
- .Net Application Developer (Software Development Job Offers)
- .net Software Engineer (Software Development Job Offers)
- .NET Consultant (Software Development Job Offers)
- Software Engineer (.NET , SQL) (Software Development Job Offers)
- ASP.Net / C# Web Developer (Web Development Job Offers)
- ProgrammersTalk.net Recruiting Forum Posters (Internet Marketing Job Offers)
- .NET developers team searches projects (Post your Resume)
Other Threads in the VB.NET Forum
- Previous Thread: counting how many text boxes have been modified
- Next Thread: Can it be done?
Views: 592 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 30minutes 2008 access add application array assignment basic binary box button buttons center click code connectionstring convert cpu data database databasesearch datagrid datagridview design designer dissertation dissertations dissertationthesis dll dosconsolevb.net editvb.net employees error excel exists firewall folder image images isnumericfuntioncall listview login math memory mobile module msaccess mssqlbackend mysql navigate net opacity page pan peertopeervideostreaming picturebox plugin port print printing printpreview problem record refresh regex reports" reuse save savedialog serial sorting sql sqldatbase storedprocedure string structures studio temp textbox timer upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web wpf xml






