| So, it's simply a matter of changing the relative path before Release? For example, I have an application that opens files using an openFileDialog control. I have two string variables, declared right after the "required designer variables", that I initialize in the form's constructor.
int myindex = Application.ExecutablePath.IndexOf("Debug");
app_directory = Application.ExecutablePath.Substring(0,myindex+6);
contacts_directory = app_directory + "Contacts\\";
Now, I then use string variable contacts_directory in the btnOpen_Click( ) event to specify the Contacts subdirectory of the application directory:
fileDialog.InitialDirectory = contacts_directory;
So, it's simply a matter of:
fileDialog.InitialDirectory = contacts_directory;
Now, never mind the fact that .InitialDirectory doesn't work right except for the first time btnOpen_Click( ) is used after the application starts. That's a separate issue that I know many, many people have complained about.
It sounds like what I need to do before building the Release is change "myindex" above to:
int myindex = Application.ExecutablePath.IndexOf("Release");
substituting "Release" for "Debug". It seems like if folders Debug and Release are on the same level, and each contains a Contacts subdirectory, that this substitution would suffice. But it does not. I get the following runtime error in debug mode:
<img src="http://www.geocities.com/kyrathaba/inline_images/app_error.JPG">
What is this "C:\DoContacts" directory?
Bryan |