Link to home
Start Free TrialLog in
Avatar of andyb7901
andyb7901

asked on

VB.Net Progress Bar

Hey,
Can someone tell me how I can use the progress bar thingy? I have a search that runs that takes a while. While this is running is it possible to have the progress bar ticking over?
Thanks
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

try set the Progress Bar's Style to Marquee, like:

ProgressBar1.Style = ProgressBarStyle.Marquee
        ProgressBar1.MarqueeAnimationSpeed = 30
Avatar of andyb7901
andyb7901

ASKER

How would I make it run though? I have the following code to do a search. While the search ir running i would like the progress bar to run as well? Can this be done?

    Private Sub SearchForFiles(ByVal StartDir As String)
        Dim DirPath As String = Path.GetDirectoryName(StartDir)
        Dim FilePattern As String = Path.GetFileName(StartDir)
        FilePattern = "*" & FilePattern & "*"
        Dim TotalFiles As Integer = 0
        lstResults.Items.Clear()
        If Directory.Exists(DirPath) Then
            Dim di As New DirectoryInfo(DirPath)
            Dim fi() As FileInfo = di.GetFiles(FilePattern, SearchOption.AllDirectories)
            For Each f As FileInfo In fi
                lstResults.Items.Add(f.FullName)
                TotalFiles += 1
            Next
        Else
            lstResults.Items.Add("Invalid Start Directory")
        End If
        lstResults.Items.Add("Total Files = " & TotalFiles.ToString())
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Im sorry to screw you around my code has changed? Could you tell me how to do it for my new code? Or shall I open a new question?
I think you should open another question, but anyway what happened to your code??????