Hi, I have a public function that generates a CRC32 checksum of a file. What I am looking to add to it is a progress bar that progresses as the checksum is created. CRC32 Function
Public Function GetCrc32(ByRef stream As System.IO.Stream) As Integer
Dim crc32Result As Integer
crc32Result = &HFFFFFFFF
Dim buffer(BUFFER\_SIZE) As Byte
Dim readSize As Integer = BUFFER\_SIZE
Dim count As Integer = stream.Read(buffer, 0, readSize)
Dim i As Integer
Dim iLookup As Integer
Dim tot As Integer = 0
Do While (count > 0)
For i = 0 To count - 1
iLookup = (crc32Result And &HFF) Xor buffer(i)
crc32Result = ((crc32Result And &HFFFFFF00) \\ &H100) And &HFFFFFF ' nasty shr 8 with vb :/
crc32Result = crc32Result Xor crc32Table(iLookup)
Next i
count = stream.Read(buffer, 0, readSize)
Loop
GetCrc32 = Not (crc32Result)
End Function
the function is then called when I click on a button
Dim f As FileStream = New FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
crc = c32.GetCrc32(f)
lblCRC32.Text = Hex(crc)
How do I add a progress bar to work with the function and display the actual progress. Thanks J