2012-10-24 2 views
2

내 프로그램에서 소프트웨어 공급 업체가 프로세스를 완료하기 위해 보낸 XML 파일을 읽어야합니다. 문제는 파일을 찾는 프로그램을 말할 수 없다는 것입니다!VB.net 폴더 경로가 포함 된 문자열 반환

내가 프로그램을 게시하고 프로그램을 설치하면 그것이 같은 폴더 이름

C 항상 다른 위치를 설치 할 때마다 임의의 폴더를 생성합니다 : \ 사용자 레이 \의 AppData \ 로컬 \ APPS \를 \ 2.0 \ 6ZNVVG8V.C6O \ 0MELQPL9.LCB \ 롤 - ..는

tion_531c8308fa0ff83d_0001.0000_5a2aee0cd0a667c1 나는이

Dim resourcePath As String = _ 
    System.IO.Path.GetFullPath(My.Resources.ResourceManager.BaseName) 
Dim rIndex As Integer = resourcePath.LastIndexOf("\") 
resourcePath = resourcePath.Substring(0, rIndex) 
Dim filePath As String = System.IO.Path.Combine(resourcePath, "Client.xml") 
,691,363을 수행하여 보여 해당 폴더를 얻는 방법을 알아 낸210

그러나 프로그램은 XML과 ICOn 파일을 임의로 생성하지만 동일한 디렉토리에 두 번째 폴더를 만듭니다.

xml에 해당 폴더를 프로그램이 보게하려면 어떻게해야합니까?

제발 도와주세요!

레이

답변

0

이 작업을 수행 할 수있는 모든 파일의

Dim query = _ 
    From d In System.IO.Directory.GetDirectories(resourcePath) 
    Let f = New FileInfo(System.IO.Path.Combine(d, "Client.xml")) 
    Where f.Exists 
    select f.FullName 

Dim filePath = query.FirstOrDefault() 
0

가져 오기 목록을 필터에 의해

lblPaymentMode.Location = New Point(lblDate.Right - lblPaymentMode.Width, lblPaymentMode.Location.Y) 
    Dim mFiles() As String = Directory.GetFiles("Path of folder", "*.xml", SearchOption.AllDirectories) 
    For i As Integer = 0 To mFiles.Count - 1 
     Debug.Print(mFiles(i)) 'print name and path of of each file 
    Next 
관련 문제