The code i used in VB .net to find a particular file on all the drives is at the bottom.
The problem is that when this executable file is to be executed on another pc ".net frame work" has to be installed on client computer, which i don't want.
I tried to re write this code in VB 6 but it shows many errors. I want the Vb 6 code.
Or if thre any other way i can run this executable file without any other framework installation. i would like to know.
Code in VB .net:
Public Class Form1
Private Sub fSearchDrives() Dim saDrives() As System.IO.DriveInfo = System.IO.DriveInfo.GetDrives() Dim sdrive As System.IO.DriveInfo For Each sdrive In saDrives Try Me.fSearchFolders(sdrive.Name) Catch ex As IO.IOException Catch ex As UnauthorizedAccessException End Try Next End Sub
Private Sub fSearchFolders(ByVal sRoot As String) Dim saFolders() As String = System.IO.Directory.GetDirectories(sRoot)
For Each sCurrentFolder As String In saFolders Me.fSearchFile(sCurrentFolder) Next End Sub
Private Sub fSearchFile(ByVal currentPath As String) Dim saFilesFound() As String = System.IO.Directory.GetFiles(currentPath, "example.exe", System.IO.SearchOption.AllDirectories) For Each sSearchedFile As String In saFilesFound MsgBox(sSearchedFile) Next End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click fSearchDrives() End Sub End Class
.NET Development36
|