Click here to Skip to main content
15,923,120 members
Home / Discussions / C#
   

C#

 
GeneralRe: Checking the date Pin
DaveyM694-Jun-09 7:52
professionalDaveyM694-Jun-09 7:52 
AnswerRe: Checking the date Pin
EliottA4-Jun-09 7:14
EliottA4-Jun-09 7:14 
GeneralRe: Checking the date Pin
Rajdeep.NET4-Jun-09 7:31
Rajdeep.NET4-Jun-09 7:31 
GeneralRe: Checking the date Pin
EliottA4-Jun-09 7:32
EliottA4-Jun-09 7:32 
AnswerRe: Checking the date Pin
fly9044-Jun-09 10:45
fly9044-Jun-09 10:45 
QuestionClipboard Operations Pin
Richard Blythe4-Jun-09 5:46
Richard Blythe4-Jun-09 5:46 
AnswerRe: Clipboard Operations Pin
led mike4-Jun-09 8:00
led mike4-Jun-09 8:00 
QuestionDigital dashboard using C# or VB and other technologies Pin
Sciencez4-Jun-09 5:27
Sciencez4-Jun-09 5:27 
AnswerRe: Digital dashboard using C# or VB and other technologies Pin
Uwe Keim4-Jun-09 5:35
sitebuilderUwe Keim4-Jun-09 5:35 
GeneralRe: Digital dashboard using C# or VB and other technologies Pin
Sciencez4-Jun-09 7:27
Sciencez4-Jun-09 7:27 
AnswerRe: Digital dashboard using C# or VB and other technologies Pin
EliottA4-Jun-09 7:19
EliottA4-Jun-09 7:19 
AnswerRe: Digital dashboard using C# or VB and other technologies Pin
Mbah Dhaim4-Jun-09 8:08
Mbah Dhaim4-Jun-09 8:08 
AnswerRe: Digital dashboard using C# or VB and other technologies Pin
Luc Pattyn4-Jun-09 11:17
sitebuilderLuc Pattyn4-Jun-09 11:17 
GeneralRe: Digital dashboard using C# or VB and other technologies Pin
Sciencez4-Jun-09 19:06
Sciencez4-Jun-09 19:06 
GeneralRe: Digital dashboard using C# or VB and other technologies Pin
Luc Pattyn5-Jun-09 0:46
sitebuilderLuc Pattyn5-Jun-09 0:46 
Questiontreeview nodes disable Pin
ravishankarreddy274-Jun-09 3:44
ravishankarreddy274-Jun-09 3:44 
AnswerRe: treeview nodes disable Pin
Pete O'Hanlon4-Jun-09 3:52
mvePete O'Hanlon4-Jun-09 3:52 
GeneralRe: treeview nodes disable Pin
Manas Bhardwaj4-Jun-09 3:57
professionalManas Bhardwaj4-Jun-09 3:57 
GeneralRe: treeview nodes disable Pin
Pete O'Hanlon4-Jun-09 4:00
mvePete O'Hanlon4-Jun-09 4:00 
AnswerRe: treeview nodes disable Pin
Manas Bhardwaj4-Jun-09 4:03
professionalManas Bhardwaj4-Jun-09 4:03 
Questionpage design problems Pin
ravishankarreddy274-Jun-09 3:40
ravishankarreddy274-Jun-09 3:40 
AnswerRe: page design problems Pin
Abhijit Jana4-Jun-09 4:06
professionalAbhijit Jana4-Jun-09 4:06 
QuestionHow to know the file version of setup developed through vs2005? Pin
svt gdwl4-Jun-09 3:14
svt gdwl4-Jun-09 3:14 
AnswerRe: How to know the file version of setup developed through vs2005? Pin
Manas Bhardwaj4-Jun-09 3:41
professionalManas Bhardwaj4-Jun-09 3:41 
QuestionIndex all files on disk Pin
Matthijs Koopman4-Jun-09 1:02
Matthijs Koopman4-Jun-09 1:02 
Hey all,

I have the following problem:

I want to add some functonallity to my application that searches your entire harddisk and lists all the files that have been found.

Now i have the following code, but when i want to look in certain folders i get an access denied error. Is there a way to get some tep. read rights for that folder?

private void bgwInit_DoWork(object sender, DoWorkEventArgs e)
       {
           //set vars
           Files = 0;
           Size = 0;
           //
           string dir = (string)e.Argument;
           List<ListViewItem> results = new List<ListViewItem>();
           string[] DirectoryArray = System.IO.Directory.GetDirectories("C:\\Windows");
           DateTime lastReport = DateTime.Now;
           if (DirectoryArray.Length != 0)
           {
               foreach (string D in DirectoryArray)
               {
                   System.IO.DirectoryInfo WDDirInfo = new System.IO.DirectoryInfo(D);
                   try
                   {
                       //for the sub dirs
                       System.IO.FileInfo[] WDFileInfo = WDDirInfo.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
                       foreach (System.IO.FileInfo FI in WDFileInfo)
                       {
                           ListViewItem itmLog = new ListViewItem();
                           itmLog.Text = FI.FullName.ToString();
                           itmLog.UseItemStyleForSubItems = true;
                           itmLog.SubItems.Add("Veilig");
                           itmLog.ForeColor = Color.Green;
                           itmLog.EnsureVisible();
                           results.Add(itmLog);
                           string path = FI.FullName.Remove(0, 3);
                           Files = (Files + 1);
                           Size = (Size + FI.Length);
                       }

                   }
                   catch (Exception ex)
                   {

                   }
                   //end of root
                   // Report back when at least 25 milliseconds have expired since last time
                   if ((DateTime.Now - lastReport).TotalMilliseconds >= 25 || results.Count > 30)
                   {
                       this.bgwInit.ReportProgress(0, results);
                       results = new List<ListViewItem>();
                       lastReport = DateTime.Now;
                   }
               }
           }
           //for the root
           try
           {
               System.IO.DirectoryInfo WDRootDir = new System.IO.DirectoryInfo("C:\\Windows");
               System.IO.FileInfo[] WDRootFileInfo = WDRootDir.GetFiles("*.*", System.IO.SearchOption.TopDirectoryOnly);
               foreach (System.IO.FileInfo FI in WDRootFileInfo)
               {
                   ListViewItem itmLog = new ListViewItem();
                   itmLog.Text = FI.FullName.ToString();
                   itmLog.UseItemStyleForSubItems = true;
                   itmLog.SubItems.Add("Veilig");
                   itmLog.ForeColor = Color.Green;
                   itmLog.EnsureVisible();
                   results.Add(itmLog);
                   string path = FI.FullName.Remove(0, 3);
                   Files = (Files + 1);
                   Size = (Size + FI.Length);
               }
           }
           catch (Exception ex)
           {

           }
           // Report back when at least 25 milliseconds have expired since last time
           if ((DateTime.Now - lastReport).TotalMilliseconds >= 25 || results.Count > 30)
           {
               this.bgwInit.ReportProgress(0, results);
               results = new List<ListViewItem>();
               lastReport = DateTime.Now;
           }
           //report progress
           this.bgwInit.ReportProgress(50, results);
           //end of void
       }

       private void bgwInit_ProgressChanged(object sender, ProgressChangedEventArgs e)
       {
           //declare listviewitem
           //file count (may be need to redesigned)
           List<ListViewItem> items = e.UserState as List<ListViewItem>;
           //start log update
           this.lstFiles.BeginUpdate();
           //for eacht log item
           foreach (ListViewItem item in items)
           {
               //add log item to log
               this.lstFiles.Items.Add(item);
               //increase progressbar value +1
           }
           //end log update
           this.lblFilesScanned.Text = this.lstFiles.Items.Count.ToString();
           this.lstFiles.EndUpdate();
           //end of void
       }

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.