string Path = Convert.ToString(txtBrowse.Text.Trim()); string Word = Convert.ToString(txtWord.Text.Trim()); foreach (string file in Directory.GetFiles(Path, "*.txt")) { contents = File.ReadAllText(file); if (contents.Contains(Word)) { string foldername = file; lbltab.Text = foldername; break; } }
string fileName = @"C:\mydir\myfile.ext"; string result = Path.GetFileName(fileName);//returns 'myfile.ext'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)