VB.Net - 하드 디스크에서 파일 찾기

이 데모를 통해 하드 드라이브에서 경로를 모르는 상태에서 검색 할 수 있습니다.

  • 양식에서 TextBox (TextBox1) 및 Label (Label1)
  • 양식의 모듈에 코드를 복사 / 붙여 넣기하십시오.

암호

 공용 클래스 Form1 Dim Trouver As String Dim Cherche As String 서브 LireRep (ByVal Chem As String) Dim Rep, sRp, Obj, sRep, sR2 Dim sCle As String, S As String Chem = Chem & IIf (Microsoft.VisualBasic .Dight (Chem & Cherche) Trouver ""Trouver = "Dro (Chem & Cherche)"그런 다음 Trouver = "\", "", "\" Chem & Trouver : Exit Sub '-------------------------------------- Obj = CreateObject ( " Microsoft.VisualBasic.Left (Rep.Name, 1) = "$"이면 GoTo Passe2 sRep = Rep.subfolders 각 sRp sRep S = UCase (sRp.Name) ) ''다음에 종료 ''다음 종료 '------------ Elimine les repertoires système Microsoft.VisualBasic.Left (S, 1) = "$ "또는 S ="WINDOWS "또는 sRp.Attributes = 19 _ 또는 Microsoft.VisualBasic.Left (S, 6) ="SYSTEM "또는 Microsoft.VisualBasic.Left (S, 7) ="PROGRAM "또는 Microsoft.VisualBasic.Left (S, 4) = "USER"_ 또는 Microsoft.VisualB asic.Left (S, 6) = "DRIVER"또는 Microsoft.VisualBasic.Left (S, 5) = "TOOLS"그런 다음 GoTo Passe On 오류 재개 다음 sR2 = sRp.subfolders NbsR = sR2.Count If Err.Number 0 Then Trouver = Dir (sCle & Cherche) Trouver "를 누른 다음 Trouver = sCle & Dir (" ", "\ ", "\ ", " " Trouver : Exit Sub When Error GoTo 0 NbsR> 0이면 '강연회'를 선택하십시오. LireRep (sCle) End If Passe : 다음 Passe2 : 'libère la mémoire Obj = Nothing Rep = Nothing sRep = Nothing sR2 = Nothing End Sub SubRireRep ( "c : \"Sub Sub Sub1 Button1_Click (System.Object, System.EventArgs로 ByVal 보낸 사람) Button1.Click Trouver = ""Cherche = Trim (TextBox1.Text) Cherche = "" ) Trouver ""그런 다음 Label1.Text = Trouver Else Label1.Text = "Fichier non trouvé"End If End Sub End Class 

다운로드

파일 다운로드

이전 기사 다음 기사

톱 팁