Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
QuestionHow to restore the default base path after using an open file dialog Pin
Dan Neely25-Jan-07 8:52
Dan Neely25-Jan-07 8:52 
AnswerRe: How to restore the default base path after using an open file dialog Pin
Dave Kreskowiak25-Jan-07 9:19
mveDave Kreskowiak25-Jan-07 9:19 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Dan Neely25-Jan-07 9:48
Dan Neely25-Jan-07 9:48 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Dave Kreskowiak25-Jan-07 10:26
mveDave Kreskowiak25-Jan-07 10:26 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Martin#25-Jan-07 19:40
Martin#25-Jan-07 19:40 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Dave Kreskowiak26-Jan-07 2:29
mveDave Kreskowiak26-Jan-07 2:29 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Martin#26-Jan-07 3:07
Martin#26-Jan-07 3:07 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Dave Kreskowiak26-Jan-07 14:07
mveDave Kreskowiak26-Jan-07 14:07 
Martin# wrote:
But if more then one person is working on an application it is often the case, that the pathes don't mach, and so you have to have a kind of hirarchy with the starting point exe-path.


Confused | :confused: I have no idea what you're talking about. It doesn't matter how many people are using the same application. The .EXE path is always returned by Application.StartupPath. CurrentDirectory is not reliable to return that path.


Martin# wrote:
For this property, we made a property designer which has to have access to a database file.
During designtime the person is entering this property which shows a form with all the database informations. He than is able to modify or choose one element of the form, which is then copied (as a string) to the property and stored in the initializecomponent code.


OK. So what? The path is stored in the startup code, preferably as a fully qualified or relative path, such as "\subfolder\file.xml".


Martin# wrote:
Also the costumer is allowed to copy the application with all the xml, xsd, db, ..-Files wherever he whants.


OK. So your application builds the absolute path from Application.StartupPath and the relative path stored somewhere:
Dim path As String = Path.Combine(Application.StartupPath, "\subfolder.file.xml")

This will hold true and work no matter what folder the customer copies the .EXE file and subfolders/files to.

THere is just about never a reason to depend on CurrentDirectory unless you're writing some kind of commandline utility.




Dave Kreskowiak
Microsoft MVP - Visual Basic


GeneralRe: How to restore the default base path after using an open file dialog Pin
Martin#28-Jan-07 22:59
Martin#28-Jan-07 22:59 
AnswerRe: How to restore the default base path after using an open file dialog Pin
Martin#25-Jan-07 9:29
Martin#25-Jan-07 9:29 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Dave Kreskowiak25-Jan-07 10:27
mveDave Kreskowiak25-Jan-07 10:27 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Martin#25-Jan-07 19:36
Martin#25-Jan-07 19:36 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Dave Kreskowiak26-Jan-07 2:23
mveDave Kreskowiak26-Jan-07 2:23 
GeneralRe: How to restore the default base path after using an open file dialog Pin
Martin#26-Jan-07 3:15
Martin#26-Jan-07 3:15 
AnswerRe: How to restore the default base path after using an open file dialog Pin
Marc Clifton25-Jan-07 12:21
mvaMarc Clifton25-Jan-07 12:21 
Questiongetting the enter key to act as a button click Pin
Rocky#25-Jan-07 8:30
Rocky#25-Jan-07 8:30 
AnswerRe: getting the enter key to act as a button click Pin
Pete O'Hanlon25-Jan-07 8:42
mvePete O'Hanlon25-Jan-07 8:42 
AnswerRe: getting the enter key to act as a button click Pin
Martin#25-Jan-07 9:02
Martin#25-Jan-07 9:02 
GeneralRe: getting the enter key to act as a button click Pin
bobsugar22225-Jan-07 23:50
bobsugar22225-Jan-07 23:50 
GeneralRe: getting the enter key to act as a button click Pin
Martin#26-Jan-07 0:18
Martin#26-Jan-07 0:18 
GeneralRe: getting the enter key to act as a button click Pin
bobsugar22226-Jan-07 2:44
bobsugar22226-Jan-07 2:44 
GeneralRe: getting the enter key to act as a button click Pin
Martin#26-Jan-07 3:28
Martin#26-Jan-07 3:28 
QuestionHow to Create TCP Server reply to a client using XML file Pin
Janani Vaithyanathan25-Jan-07 7:35
Janani Vaithyanathan25-Jan-07 7:35 
AnswerRe: How to Create TCP Server reply to a client using XML file Pin
Marc Clifton25-Jan-07 8:27
mvaMarc Clifton25-Jan-07 8:27 
GeneralRe: How to Create TCP Server reply to a client using XML file Pin
Janani Vaithyanathan26-Jan-07 7:55
Janani Vaithyanathan26-Jan-07 7:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.