Click here to Skip to main content
16,015,072 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Mscomcontrol and Mswinsck.ocx.. Pin
Paul Conrad21-Sep-08 7:31
professionalPaul Conrad21-Sep-08 7:31 
GeneralRe: Mscomcontrol and Mswinsck.ocx.. Pin
Subjugate21-Sep-08 14:58
Subjugate21-Sep-08 14:58 
QuestionSaving a list of products [modified] Pin
Zaegra21-Sep-08 2:20
Zaegra21-Sep-08 2:20 
AnswerRe: Saving a list of products Pin
Ashfield21-Sep-08 21:46
Ashfield21-Sep-08 21:46 
GeneralRe: Saving a list of products Pin
Zaegra22-Sep-08 6:03
Zaegra22-Sep-08 6:03 
GeneralRe: Saving a list of products Pin
Ashfield22-Sep-08 8:53
Ashfield22-Sep-08 8:53 
AnswerRe: Saving a list of products Pin
Thomas Stockwell22-Sep-08 6:17
professionalThomas Stockwell22-Sep-08 6:17 
QuestionFile Counting Performance Pin
Sonhospa21-Sep-08 1:34
Sonhospa21-Sep-08 1:34 
Hello everybody,

being rather new to VB.NET (VS 2008 Express) I have to admit that I study much more than producing results. So first of all: Thank you everybody in here for an invaluable source of inspiration, which is highly appreciated!

One of the little tools I'm playing around with is just listing the number of files in all the directories / subdirectories of a selected Path. Since a path might contain several folders with approx. 30.000 larger files (8 MB each), I'm a bit worried about performance and would like to ask for review and advice:

- I'm using two backgroundworkers, the first of which is intended to proceed a total files count (incl. all the subdirs in the path) in order to set the maximum for a progress indicator:

total = My.Computer.FileSystem.GetFiles(PathName, FileIO.SearchOption.SearchAllSubDirectories).Count

- the second BW calls the function "zählung" which loops through the subdirs and updates the progress indicater through the _ProgressChanged event:


    Private Sub Zählung(ByVal obj As String)<br />
        Dim subfolders As System.Collections.ObjectModel.ReadOnlyCollection(Of String)<br />
        Dim files As System.Collections.ObjectModel.ReadOnlyCollection(Of String)<br />
<br />
        On Error Resume Next<br />
        Me.Refresh()<br />
        If BackgroundWorker2.CancellationPending Then Exit Sub<br />
<br />
        If InStr(1, obj, "RECYCLER") > 0 Or InStr(1, obj, "System") > 0 Then<br />
            'MsgBox(obj & " ist ein Systemordner", , USRINFO)<br />
        Else<br />
            If My.Computer.FileSystem.FileExists(obj & "\" & "Thumbs.db") Then<br />
                My.Computer.FileSystem.DeleteFile(obj & "\" & "Thumbs.db")<br />
                'MsgBox("Thumbs im Verzeichnis " & Pfad & " gelöscht!", MsgBoxStyle.Information, USRINFO)<br />
            End If<br />
<br />
            subfolders = My.Computer.FileSystem.GetDirectories(obj)<br />
            files = My.Computer.FileSystem.GetFiles(obj, FileIO.SearchOption.SearchTopLevelOnly)<br />
            ordner = ordner + subfolders.Count<br />
            dateien = dateien + files.Count<br />
<br />
            If total = Nothing Then<br />
'initially the progress indicator style has been set to marquee<br />
                BackgroundWorker2.ReportProgress(dateien * 100 / dateien, obj)<br />
            Else<br />
'progress indicator style has been set to continuous before, when BW1 is finished<br />
                BackgroundWorker2.ReportProgress(dateien * 100 / total, obj)<br />
            End If<br />
<br />
            For Each unterordner As String In subfolders<br />
                Zählung(unterordner)<br />
            Next<br />
        End If


During above function (i.e. ReportProgress) each path is also shown in a form label, and an additional timer-label (showing the time elapsed) is updated. How can I limit these updates to e.g. once per second?

After reading e.g. about "virtual listview" control, I really doubt D'Oh! | :doh: that my methods are performing the best way they could. Would you be so kind and let me know any better performing ways?

Thank you very much
and have a nice day

Michael
AnswerRe: File Counting Performance Pin
Guffa21-Sep-08 22:41
Guffa21-Sep-08 22:41 
QuestionRe: File Counting Performance Pin
Sonhospa21-Sep-08 23:20
Sonhospa21-Sep-08 23:20 
AnswerRe: File Counting Performance Pin
Guffa24-Sep-08 20:41
Guffa24-Sep-08 20:41 
GeneralRe: File Counting Performance Pin
Sonhospa25-Sep-08 7:03
Sonhospa25-Sep-08 7:03 
QuestionSolution Explorer Control? Pin
Saul Johnson20-Sep-08 23:20
Saul Johnson20-Sep-08 23:20 
QuestionGraphics Bitmap Pin
Gagan.2020-Sep-08 17:32
Gagan.2020-Sep-08 17:32 
AnswerRe: Graphics Bitmap Pin
Christian Graus20-Sep-08 19:54
protectorChristian Graus20-Sep-08 19:54 
QuestionTop Most Window Pin
Gagan.2020-Sep-08 17:30
Gagan.2020-Sep-08 17:30 
AnswerRe: Top Most Window Pin
Christian Graus20-Sep-08 19:56
protectorChristian Graus20-Sep-08 19:56 
AnswerRe: Top Most Window Pin
Caio Kinzel Filho22-Sep-08 5:55
Caio Kinzel Filho22-Sep-08 5:55 
QuestionCreatingTop Most Window Program Pin
Gagan.2020-Sep-08 6:40
Gagan.2020-Sep-08 6:40 
AnswerRe: CreatingTop Most Window Program Pin
jzonthemtn20-Sep-08 9:07
jzonthemtn20-Sep-08 9:07 
GeneralRe: CreatingTop Most Window Program Pin
Gagan.2020-Sep-08 17:26
Gagan.2020-Sep-08 17:26 
GeneralRe: CreatingTop Most Window Program Pin
Christian Graus20-Sep-08 19:59
protectorChristian Graus20-Sep-08 19:59 
GeneralRe: CreatingTop Most Window Program Pin
Saul Johnson20-Sep-08 23:15
Saul Johnson20-Sep-08 23:15 
AnswerRe: CreatingTop Most Window Program Pin
Paul Conrad20-Sep-08 10:36
professionalPaul Conrad20-Sep-08 10:36 
QuestionDeployement (.cab) project Pin
Gagan.2020-Sep-08 4:57
Gagan.2020-Sep-08 4:57 

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.