شكلك سويت كوبي وبست بدون ماتغير شي
مهم : عليك استخدام on error resume next
عشان مايطلع لك خطأ Access to the path is denied > اذا بتشغل البرنامج بمسؤول مارح يطلع لك
PHP كود :
Private Sub Form1_Load(sender As Object, e As EventArgs)
Dim path As String = ""
Dim folderPath As String = Environment.GetEnvironmentVariable("ProgramFiles(x86)")
Dim temp As New DirectoryInfo(folderPath)
path = SearchFile(temp, "chrome.exe")
MessageBox.Show(path)
End Sub
Private Function SearchFile(SearchDir As DirectoryInfo, searchFileName As String) As String
on error resume next
Dim temp As String = ""
For Each file As FileInfo In SearchDir.GetFiles(searchFileName, SearchOption.AllDirectories)
If file.Name = searchFileName Then
Return file.FullName
End If
Next
Return temp
End Function
مهم : عليك استخدام on error resume next
عشان مايطلع لك خطأ Access to the path is denied > اذا بتشغل البرنامج بمسؤول مارح يطلع لك

