Click here to Skip to main content
15,888,320 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# check for folder in directory path location Pin
OriginalGriff23-May-13 11:44
mveOriginalGriff23-May-13 11:44 
GeneralRe: C# check for folder in directory path location Pin
classy_dog23-May-13 12:40
classy_dog23-May-13 12:40 
GeneralRe: C# check for folder in directory path location Pin
Dave Kreskowiak23-May-13 15:40
mveDave Kreskowiak23-May-13 15:40 
GeneralRe: C# check for folder in directory path location Pin
OriginalGriff23-May-13 19:38
mveOriginalGriff23-May-13 19:38 
GeneralRe: C# check for folder in directory path location Pin
Dave Kreskowiak24-May-13 2:04
mveDave Kreskowiak24-May-13 2:04 
GeneralRe: C# check for folder in directory path location Pin
classy_dog24-May-13 4:55
classy_dog24-May-13 4:55 
GeneralRe: C# check for folder in directory path location Pin
OriginalGriff24-May-13 5:06
mveOriginalGriff24-May-13 5:06 
AnswerRe: C# check for folder in directory path location Pin
BillWoodruff23-May-13 20:03
professionalBillWoodruff23-May-13 20:03 
Note that what you are doing here (and what the replies show you how to do) is checking for the presence of a string within another string.

Checking for the "validity" of a Directory, its actual existence, when your program is running, before you take some action, like writing a file to that Directory, is another thing. .NET hands you some excellent tools for checking whether Directories, or Files, actually exist.

The System.IO library offers a host of static methods such as File.Exists("file path"), Directory.Exists("directory file path") to check run-time existence. And, for more complex purposes, you can create an instance of a DirectoryInfo object, which has Properties like .Exists.

There are several reasons that these functions could return 'false: some are obvious, like the fact that the Directory/File doesn't exist any more; others more subtle, like you have some invalid character in the path name.

Based on your questions, I suggest you get a good basic book on C# programming, and study the different operators you can use with a 'string object.

And then, think about what you are going to do if the string you have in your Application Settings is incorrect: that will take you into studying the tools offered by the System.IO library.

Study, experiment, practice, analyze your errors: learn Smile | :)

yours, Bill
“Humans are amphibians: half spirit, half animal; as spirits they belong to the eternal world; as animals they inhabit time. While their spirit can be directed to an eternal object, their bodies, passions, and imagination are in continual change, for to be in time, means to change. Their nearest approach to constancy is undulation: repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis

QuestionHow to use keyboard keys instead of mouse for space invaders Pin
Ruben X Ashley David23-May-13 5:58
Ruben X Ashley David23-May-13 5:58 
AnswerMessage Removed Pin
23-May-13 6:35
professionalN_tro_P23-May-13 6:35 
GeneralRe: How to use keyboard keys instead of mouse for space invaders Pin
Ruben X Ashley David23-May-13 6:51
Ruben X Ashley David23-May-13 6:51 
GeneralRe: How to use keyboard keys instead of mouse for space invaders Pin
Dave Kreskowiak23-May-13 7:24
mveDave Kreskowiak23-May-13 7:24 
AnswerMessage Removed Pin
23-May-13 7:26
professionalN_tro_P23-May-13 7:26 
GeneralRe: How to use keyboard keys instead of mouse for space invaders Pin
Ruben X Ashley David23-May-13 7:45
Ruben X Ashley David23-May-13 7:45 
QuestionRe: Set Color of Pen and Brush Pin
ASPnoob22-May-13 21:06
ASPnoob22-May-13 21:06 
AnswerRe: Set Color of Pen and Pen Pin
Bernhard Hiller22-May-13 21:17
Bernhard Hiller22-May-13 21:17 
GeneralRe: Set Color of Pen and Brush Pin
ASPnoob22-May-13 21:34
ASPnoob22-May-13 21:34 
AnswerRe: Set Color of Pen and Pen Pin
DaveyM6922-May-13 21:34
professionalDaveyM6922-May-13 21:34 
GeneralRe: Set Color of Pen and Brush Pin
ASPnoob22-May-13 21:44
ASPnoob22-May-13 21:44 
GeneralRe: Set Color of Pen and Pen Pin
DaveyM6922-May-13 21:54
professionalDaveyM6922-May-13 21:54 
QuestionNew Button in SaveFileDialog Pin
umd22-May-13 9:38
umd22-May-13 9:38 
AnswerRe: New Button in SaveFileDialog Pin
Mycroft Holmes22-May-13 12:50
professionalMycroft Holmes22-May-13 12:50 
AnswerRe: New Button in SaveFileDialog Pin
Abhinav S22-May-13 18:27
Abhinav S22-May-13 18:27 
AnswerRe: New Button in SaveFileDialog Pin
Richard MacCutchan22-May-13 21:06
mveRichard MacCutchan22-May-13 21:06 
AnswerRe: New Button in SaveFileDialog Pin
umd23-May-13 8:52
umd23-May-13 8:52 

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.