i want to delete only selected file in datagridview. now all files can be deleted from directroy folder.so plz give me good answer.
here is my code,
foreach (DataGridViewRow dr in datagridscanedfiles.Rows)
{
for (int i = datagridscanedfiles.Rows.Count - 1; i >= 0; i--)
{
if ((bool)datagridscanedfiles.Rows[0].Cells[0].Value)
{
DirectoryInfo directoryInfo = new DirectoryInfo(@"D:\mohan\MACRO WINDOWS\MACRO WINDOWS\MACRO WINDOWS\Scan\");
foreach (var file in directoryInfo.GetFiles("*.*", SearchOption.AllDirectories))
{
FileInfo file=new FileInfo (@"D:\mohan\MACRO WINDOWS\MACRO WINDOWS\MACRO WINDOWS\Scan\");
file.Delete();
}
scanfile.Clear();
datagridscanedfiles.Rows.RemoveAt(i);
picboxscan.Image = null;
}
}