2014-04-21 2 views
0

Visual Basic 2012 프로그램을 만들고 있는데 응용 프로그램 설치 폴더에 예제 그림의 데이터를 저장하고 싶습니다. 고맙습니다. 그림을 저장하는 bin이라는 폴더에 폴더를 넣을 수있게하기 위해 응용 프로그램 설치 또는 bin 폴더를 얻으려면 어떤 코드를 사용해야합니까?비쥬얼 기본 설치 디렉토리

답변

0

사용중인 언어를 사용하지 않았습니다. Visual Basic .NET 경우 :

System.AppDomain.CurrentDomain.BaseDirectory & "Pictures" 
System.IO.Directory.GetCurrentDirectory() & "\Pictures"  System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location) & "\Pictures" 
Application.StartupPath & "\Pictures" 'WinForm 
Request.PhysicalApplicationPath() 'WebApplication 

C# 경우 :

System.AppDomain.CurrentDomain.BaseDirectory + "Pictures"; 
System.IO.Directory.GetCurrentDirectory() + @"\Pictures"; System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\Pictures"; 
Application.StartupPath + @"\Pictures"; //WinForm 
Request.PhysicalApplicationPath; //WebApplication 

[편집] 자신의 의견에 대한 @Cody 회색에

감사합니다, 당신은 권한 문제가 당신이 사진을 저장할 수 있었다면 사용자의 "Application Data" 폴더 는 VB

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) 

에 그리고 C#이 폴더 경로를 얻으려면 :

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); 
+0

문제는, 당신은 응용 프로그램 디렉토리에 쓰기 권한이 없어야합니다. 최신 Windows 버전에서는 일반 사용자가 사용하지 않습니다. 이 내용은 "응용 프로그램 데이터"또는 문서 폴더로 이동해야합니다. –

+0

그는이 문제에 관해서 언급하지 않았고, 응용 프로그램 디렉토리를 원했습니다. –