Click here to Skip to main content
15,883,901 members
Home / Discussions / C#
   

C#

 
GeneralRe: My Vote if 1 Pin
Keith Barrow10-Mar-13 0:58
professionalKeith Barrow10-Mar-13 0:58 
AnswerRe: code wave Pin
Marco Bertschi10-Mar-13 4:34
protectorMarco Bertschi10-Mar-13 4:34 
Questioncompression wave Pin
samir razzak10-Mar-13 0:17
samir razzak10-Mar-13 0:17 
AnswerRe: compression wave Pin
OriginalGriff10-Mar-13 0:56
mveOriginalGriff10-Mar-13 0:56 
AnswerRe: compression wave Pin
Marco Bertschi10-Mar-13 4:35
protectorMarco Bertschi10-Mar-13 4:35 
GeneralRe: compression wave Pin
dusty_dex10-Mar-13 6:13
dusty_dex10-Mar-13 6:13 
Question[Resolved] Searching for a file in multiple directories? Pin
Goaty651099-Mar-13 16:43
Goaty651099-Mar-13 16:43 
AnswerRe: Searching for a file in multiple directories? Pin
OriginalGriff9-Mar-13 22:39
mveOriginalGriff9-Mar-13 22:39 
I'm not absolutely clear what you are trying to do - it may be that I need more coffee - but I think you are trying to supply a root folder and access all the files under that that are called "settings.txt", then read a setting value from each of those and display them all in a combobox.

If so, then I think you are trying to force the wrong methods to do the job. Lets just step back a litle and look at the task:
Find all files called "settings.txt" somewhere in a folder heiracrchy.
Well, you are locating att teh top level folders under the root ok with DirectoryInfo.GetDirectory, but that isn't quite what you want. Not only does it return a DirectoryInfo object (which contains the string you think you want in the FullName property) but there is a much, much easier way to do exactly what you want:
C#
string[] SettingsFiles = Directory.GetFiles(@"D:\Temp\", "Settings.txt", SearchOption.AllDirectories);
foreach (string file in SettingsFiles)
    {
    Console.WriteLine(file);
    }

You can then simply read each file since you have it's full path and name.

Doesn't this do what you want?
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

GeneralRe: Searching for a file in multiple directories? Pin
Goaty651099-Mar-13 23:05
Goaty651099-Mar-13 23:05 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff9-Mar-13 23:23
mveOriginalGriff9-Mar-13 23:23 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty651099-Mar-13 23:31
Goaty651099-Mar-13 23:31 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff9-Mar-13 23:42
mveOriginalGriff9-Mar-13 23:42 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty651099-Mar-13 23:54
Goaty651099-Mar-13 23:54 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 0:00
mveOriginalGriff10-Mar-13 0:00 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 0:34
Goaty6510910-Mar-13 0:34 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 0:55
mveOriginalGriff10-Mar-13 0:55 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 1:03
Goaty6510910-Mar-13 1:03 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 1:12
mveOriginalGriff10-Mar-13 1:12 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 1:16
Goaty6510910-Mar-13 1:16 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 1:23
mveOriginalGriff10-Mar-13 1:23 
QuestionSuggestions: textbox background and foreground colours. Pin
Septimus Hedgehog9-Mar-13 10:58
Septimus Hedgehog9-Mar-13 10:58 
AnswerRe: Suggestions: textbox background and foreground colours. Pin
Ravi Bhavnani9-Mar-13 13:01
professionalRavi Bhavnani9-Mar-13 13:01 
GeneralRe: Suggestions: textbox background and foreground colours. Pin
Septimus Hedgehog9-Mar-13 23:02
Septimus Hedgehog9-Mar-13 23:02 
QuestionIf statement Pin
Sottyoru9-Mar-13 7:07
Sottyoru9-Mar-13 7:07 
AnswerRe: If statement Pin
PIEBALDconsult9-Mar-13 7:58
mvePIEBALDconsult9-Mar-13 7:58 

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.