22-09-12, 09:34 PM
اخي اعطيك بعض النتائج
تنيجة 1
نتيجة 2
تنيجة 1
PHP كود :
Dim sr As New FileStream("[Input-file]", IO.FileMode.Open) Dim sw As New FileStream("[Output-file]", IO.FileMode.Create) Dim len As Long = sr.Length - 1 Dim buffer(1024) As Byte Dim bytesread As Integer
While sr.Position < len bytesread = (sr.Read(buffer, 0, 1024)) sw.Write(buffer, 0, bytesread) mainscreen.FileProgress.Value = CInt(sr.Position / len * 100) Application.DoEvents() End While
sw.Flush() sw.Close() sr.Close()
نتيجة 2
PHP كود :
Sub copyfilewithprogress() Dim path As String = Application.StartupPath & "\" Dim mediafile As String = "Amy Diamond - What's in it for me.mp3" Dim fi As New IO.FileInfo(mediafile) Dim sr As New IO.FileStream(path & mediafile, IO.FileMode.Open) 'source file Dim sw As New IO.FileStream(path & "copy of " & mediafile, IO.FileMode.Create) 'target file, defaults overwrite Dim len As Long = sr.Length - 1 For i As Long = 0 To len sw.WriteByte(sr.ReadByte) If i Mod 1000 = 0 Then 'only update UI every 1 Kb copied ProgressBar1.Value = i * 100 / len Application.DoEvents() End If Next ProgressBar1.Value = 0End Sub
