Share via


방법: Visual Basic에서 내 문서 디렉터리의 내용 검색

업데이트: 2007년 11월

My.Computer.FileSystem.SpecialDirectories 개체를 사용하면 내 문서 또는 바탕 화면 등과 같은 많은 All Users 디렉터리를 읽을 수 있습니다.

내 문서 폴더를 읽으려면

  • 특정 디렉터리에 있는 각 파일에서 텍스트를 읽으려면 ReadAllText 메서드를 사용합니다. 다음 코드에서는 디렉터리와 파일을 지정한 다음 ReadAllText를 사용하여 텍스트를 patients라는 이름의 문자열로 읽어옵니다.

    Dim path As String
    Dim patients As String
    path = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & "Patients.txt"
    patients = My.Computer.FileSystem.ReadAllText(path)
    

참고 항목

참조

My.Computer.FileSystem.SpecialDirectories 개체

My.Computer.FileSystem.SpecialDirectories 개체 멤버

My.Computer.FileSystem.ReadAllText 메서드