I create a web site that helps user to retrieve file from direction D drive depend on creation date and view the files in list box , If user enter the date in text box the list will show only the files which are same as user entered date.I don't get any error but when I write if (TextBox1.Text.Equals(dt.ToString("dd/MM/yyyy"))) this code line no file display on list box however I want to get files based on compare between user entre date and get creation file date .
protected void Button1_Click(object sender, EventArgs e)
{
DirectoryInfo dinfo = new DirectoryInfo(@"D:\Local_temp");
FileInfo[] files = dinfo.GetFiles("*.MSG");
DateTime dt;
foreach (FileInfo file in files)
{
dt = File.GetCreationTime(file.ToString());
if (TextBox1.Text.Equals(dt.ToString("dd/MM/yyyy")))
// DateTime dt = file.CreationTime;
ListBox1.Items.Add(file.Name);
}
}