تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
ايجاد ملف
#1
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim path As String
        Dim temp As New DirectoryInfo("InitialPathToSearch")
        path = SearchFile(temp, "filename.exe")
        MsgBox(path)
    End Sub
on error resume next
كود :
Private Function SearchFile(ByVal SearchDir As DirectoryInfo, ByVal searchFileName As String) As String
        Dim temp As String = ""
        If SearchDir.GetFiles(searchFileName).Length > 0 Then
            Return SearchDir.FullName & "\" & searchFileName
        End If
        Dim Directories() As DirectoryInfo = SearchDir.GetDirectories("*")
        For Each newDir As DirectoryInfo In Directories
            temp = SearchFile(newDir, searchFileName)
        Next
        Return temp
    End Function
المشكلة فى الكود ان مسار البرنامج يطلع هكذا
إقتباس :C:\Users\Osama\AppData\Local\Temporary Projects\WindowsApplication1\bin\Debug\InitialPathToSearch\chrome.exe
لكن المسار الحقيق
إقتباس :"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
فهل يوجد حل غير تغير
كود :
Dim temp As New DirectoryInfo("InitialPathToSearch")
الى
كود :
Dim temp As New DirectoryInfo("C:\Program Files (x86)\Google\Chrome\Application")
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
ايجاد ملف - بواسطة أسامة_mybb_import9019 - 03-08-13, 10:38 AM
ايجاد ملف - بواسطة AHMED HUSSIEN - 03-08-13, 11:29 AM
ايجاد ملف - بواسطة الشاكي لله_mybb_import4784 - 03-08-13, 11:34 AM
ايجاد ملف - بواسطة أسامة_mybb_import9019 - 03-08-13, 03:07 PM
ايجاد ملف - بواسطة أسامة_mybb_import9019 - 03-08-13, 03:12 PM
ايجاد ملف - بواسطة الشاكي لله_mybb_import4784 - 03-08-13, 03:52 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم