I have a solution that works. I Found a function that copies the file using FileStream. The issue I have is that when my program runs and gets to where the progress bar starts to update, the memory usage for my program jumps to almost 400MB.
The purpose of my program is to copy an oracle export file. These files can range from 20MB to several GB. I want my user to know how far along the copy is.
My question is am I doing this correctly and if not what is the correct way to accomplish.
Private Sub CopyFile(ByVal OldFile As String, ByVal NewFile As String)
Dim n As Integer
Me.pbCopyProgress.Value = 0
Dim FS As New FileStream(OldFile, FileMode.Open)
Dim FW As New FileStream(NewFile, FileMode.Truncate, FileAccess.ReadWrite)
Dim Buffer() As Byte
'Get the bytes from file to a byte array
ReDim Buffer(FS.Length - 1)
Me.pbCopyProgress.Maximum = (FS.Length / 100) + 1000
FS.Read(Buffer, 0, Buffer.Length)
'Do your stuff :-)
For i As Int32 = 0 To Buffer.Length - 1
n += 1
If n = 100 Then
Me.pbCopyProgress.Value += 1
n = 0