Click here to Skip to main content
15,920,632 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created an application that converts files in a static folder. I would like to have a progress to show the user how much is left to convert till completion.

Can someone please be of assistance :)

thanks.

[EDIT - OP code from a "solution"]
Hi,

Here is my code for the convert part. I have no idea how to write code for a progress bar as this is the first time I am actually willing to use one.

Sub RecurseDirectory(ByRef sPath As String)
        Try
            Dim counter = My.Computer.FileSystem.GetFiles(sPath)
            MsgBox("Number of files is: " & CStr(counter.Count))
            'Dim i As Integer = CInt(counter)
            Dim di As New IO.DirectoryInfo(sPath)
            Dim disub As IO.DirectoryInfo() = di.GetDirectories()
            Dim diar1 As IO.FileInfo() = di.GetFiles("*.vox")
            Dim diri As IO.DirectoryInfo
            Dim dra As IO.FileInfo
            'di.GetDirectories()
            'list the names of all files in the specified directory
            For Each diri In disub
                RecurseDirectory(diri.FullName)
            Next
            Dim myArrayList As New ArrayList
            For Each dra In diar1
                frmMain.lblFileName.Text = dra.FullName
                uLaw(frmMain.lblFileName.Text, Replace(frmMain.lblFileName.Text, ".vox", ".wav"))
                'Vox2Mp3(frmMain.lblFileName.Text, Replace(frmMain.lblFileName.Text, ".vox", ".mp3"))
                frmMain.lblFileName.Refresh()
                Application.DoEvents()
                System.Threading.Thread.Sleep(50)
<''''''progress>
Posted
Updated 14-Jan-14 13:35pm
v2

Progress can be calculated by (Number Complete / Total Number) * 100 (to give a percentage)

So each time you finish converting a file, increase an Integer variable by one, then use that.

If you're using a ProgressBar control on a WinForm, set the MinimumValue to 0, MaximumValue to the total number of files to convert, then set the Value property to how many files you've converted in your loop
 
Share this answer
 
its easy frnd u have to calculate the full file bits or bayts (its depends on the way you convert the file) then set the max value for progress par with the calculate resulte and add one with every single bits or byte or char u convert if u write ur code i can fix it for u
 
Share this answer
 
Comments
CHill60 14-Jan-14 19:36pm    
what is a "bayt" ? And please do not use "txtspk" in any response

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900