|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB.NET Progress Bar - Recursive Searchsearches through the specified directory they can see their status. the progress bar name is on form2 and is named progstatus. Does anyone know how to set this up with the code below? appreciate it. thank you. Private Function Dir(ByVal sDir As String) Try Dim strDir As String Windows.Forms.Cursor.Current = Cursors.WaitCursor For Each strDir In System.IO.Directory.GetDirectories(sDir) If blnClosed = True Then Return intDirCount Exit Function End If Dir(strDir) intDirCount = intDirCount + 1 Next Return intDirCount Windows.Forms.Cursor.Current = Cursors.Arrow Catch ex As Exception Return intDirCount Windows.Forms.Cursor.Current = Cursors.Arrow MsgBox(ex, MsgBoxStyle.Information, "Exception") End Try End Function Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuery.Click intDirCount = 0 Dim strResults As String = Dir(Trim(LCase(txtDirSource.Text))) MsgBox("Number of Directories: " & strResults, MsgBoxStyle.Information, "Query Statistics") End Sub Didn't quite follow the details of what you are doing, but here is something
similar I have used that mght help. Here I was sifting through files in a folder looking for the newest one. With ProgressBar .Maximum = My.Computer.FileSystem.GetFiles(SourcePath).Count .Minimum = 0 .Step = 1 .Value = 1 End With For Each foundFile As String In My.Computer.FileSystem.GetFiles(SourcePath) Me.ProgressBar.PerformStep() '-- do some stuff. Next Show quoteHide quote "Gabe Matteson" <gmattesonATinqueryDOTbiz> wrote in message news:uraI54e0GHA.2036@TK2MSFTNGP05.phx.gbl... > I am trying to set the maximum value of the progress bar so that when a user > searches through the specified directory they can see their status. the > progress bar name is on form2 and is named progstatus. Does anyone know how > to set this up with the code below? appreciate it. thank you. > > > > > > Private Function Dir(ByVal sDir As String) > > Try > > Dim strDir As String > > Windows.Forms.Cursor.Current = Cursors.WaitCursor > > For Each strDir In System.IO.Directory.GetDirectories(sDir) > > If blnClosed = True Then > > Return intDirCount > > Exit Function > > End If > > Dir(strDir) > > intDirCount = intDirCount + 1 > > Next > > Return intDirCount > > Windows.Forms.Cursor.Current = Cursors.Arrow > > Catch ex As Exception > > Return intDirCount > > Windows.Forms.Cursor.Current = Cursors.Arrow > > MsgBox(ex, MsgBoxStyle.Information, "Exception") > > End Try > > End Function > > > > > > Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnQuery.Click > > intDirCount = 0 > > Dim strResults As String = Dir(Trim(LCase(txtDirSource.Text))) > > > > MsgBox("Number of Directories: " & strResults, MsgBoxStyle.Information, > "Query Statistics") > > End Sub > > > awesome, thanks!
you wouldn't happen to know how to incorporate the maximum to = that of all directories and files?.. again, thanks! Show quoteHide quote "Skip" <skipper1***@yahoo.com> wrote in message news:%23105tMR2GHA.4976@TK2MSFTNGP02.phx.gbl... > Didn't quite follow the details of what you are doing, but here is > something > similar I have used that mght help. Here I was sifting through files in a > folder looking for the newest one. > > > > With ProgressBar > > .Maximum = My.Computer.FileSystem.GetFiles(SourcePath).Count > > .Minimum = 0 > > .Step = 1 > > .Value = 1 > > End With > > For Each foundFile As String In > My.Computer.FileSystem.GetFiles(SourcePath) > > Me.ProgressBar.PerformStep() > > '-- do some stuff. > > Next > > > > "Gabe Matteson" <gmattesonATinqueryDOTbiz> wrote in message > news:uraI54e0GHA.2036@TK2MSFTNGP05.phx.gbl... >> I am trying to set the maximum value of the progress bar so that when a > user >> searches through the specified directory they can see their status. the >> progress bar name is on form2 and is named progstatus. Does anyone know > how >> to set this up with the code below? appreciate it. thank you. >> >> >> >> >> >> Private Function Dir(ByVal sDir As String) >> >> Try >> >> Dim strDir As String >> >> Windows.Forms.Cursor.Current = Cursors.WaitCursor >> >> For Each strDir In System.IO.Directory.GetDirectories(sDir) >> >> If blnClosed = True Then >> >> Return intDirCount >> >> Exit Function >> >> End If >> >> Dir(strDir) >> >> intDirCount = intDirCount + 1 >> >> Next >> >> Return intDirCount >> >> Windows.Forms.Cursor.Current = Cursors.Arrow >> >> Catch ex As Exception >> >> Return intDirCount >> >> Windows.Forms.Cursor.Current = Cursors.Arrow >> >> MsgBox(ex, MsgBoxStyle.Information, "Exception") >> >> End Try >> >> End Function >> >> >> >> >> >> Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As >> System.EventArgs) Handles btnQuery.Click >> >> intDirCount = 0 >> >> Dim strResults As String = Dir(Trim(LCase(txtDirSource.Text))) >> >> >> >> MsgBox("Number of Directories: " & strResults, MsgBoxStyle.Information, >> "Query Statistics") >> >> End Sub >> >> >> > > more or less, i have the program searching through a file system to return a
list of files and folders that have not been accessed in a certain period of time. i want to be able to get a total count of the items in a specified directory and have the progressbar keep track of the recursive search status, so the max. value would equal the number of items in a directory... Show quoteHide quote "Gabe Matteson" <gmattesonATinqueryDOTbiz> wrote in message news:uraI54e0GHA.2036@TK2MSFTNGP05.phx.gbl... >I am trying to set the maximum value of the progress bar so that when a >user > searches through the specified directory they can see their status. the > progress bar name is on form2 and is named progstatus. Does anyone know > how > to set this up with the code below? appreciate it. thank you. > > > > > > Private Function Dir(ByVal sDir As String) > > Try > > Dim strDir As String > > Windows.Forms.Cursor.Current = Cursors.WaitCursor > > For Each strDir In System.IO.Directory.GetDirectories(sDir) > > If blnClosed = True Then > > Return intDirCount > > Exit Function > > End If > > Dir(strDir) > > intDirCount = intDirCount + 1 > > Next > > Return intDirCount > > Windows.Forms.Cursor.Current = Cursors.Arrow > > Catch ex As Exception > > Return intDirCount > > Windows.Forms.Cursor.Current = Cursors.Arrow > > MsgBox(ex, MsgBoxStyle.Information, "Exception") > > End Try > > End Function > > > > > > Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnQuery.Click > > intDirCount = 0 > > Dim strResults As String = Dir(Trim(LCase(txtDirSource.Text))) > > > > MsgBox("Number of Directories: " & strResults, MsgBoxStyle.Information, > "Query Statistics") > > End Sub > > >
SQL parameter: what is wrong here?
WebRequest.Create Exporting a vb.net datagrid to excel Formatting text w/VB.NET Abstraction question Calling a VB.NET-DLL FROM VB6 Iterating through the records in a dataset DataGridView visible columns Access of shared member, constant member, enum member or nested type through an instance Two threads are accessing my Synclocked code |
|||||||||||||||||||||||