5
Answers

C# obtain directory path information

Sie Ste

Sie Ste

11y
1.2k
1
In a new C# 2010 windows form application that I will be writing, I have the following items to mention:

1. The form will have the following 2 places for the user to select/enter data:
 a. customer id, and b. a window where the user can select the directory path  of
  where they want to select a file from.
2. There will also be a submit button to click to show all the data has been entered, and
3. an area that will show when an invalid customer id has been entered. 
4. The following is a url that I know that I can use as a reference for allowin the user to select
the directory of the file they want to use: http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx.

Now I have the following questions to ask:
1. How would I setup a default directory for where the file should be located?
2. How should I setup code that will allow the user to select the directory path of where a file is located at? Do you need to have an extra button for the user to be able to 'select' the directory path?
3. How Do I take the values that have been entered on the windows form and pass the values back to the main method that called the windows form?
4. Can you show me code how on to tell the user they entered an invalid customer id?

Answers (5)