Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
- Try
- myStream = openFileDialog1.OpenFile()
- If (myStream IsNot Nothing) Then
- Dim data(myStream.Length) As Byte
- md5.ComputeHash(data, 0, myStream.Length)
- Dim hash As Byte() = md5.Hash
- Dim buff As StringBuilder = New StringBuilder
- Dim hashByte As Byte
- For Each hashByte In hash
- buff.Append(String.Format("{0:X1}", hashByte))
- Next
- md5checksum = buff.ToString()
- MessageBox.Show(md5checksum)
- End If
- Catch Ex As Exception
- MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
- Finally
- ' Check this again, since we need to make sure we didn't throw an exception on open.
- If (myStream IsNot Nothing) Then
- myStream.Close()
- End If
- End Try
Add Comment
Please, Sign In to add comment