Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
Using fo As New OpenFileDialog With
{.Filter = "JpG (*.jpg)|*.jpg|Gif (*.gif)|*.gif|All files (*.*)|*.*"}
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(fo.FileName, _
IO.FileMode.Open)
Dim br As New IO.BinaryReader(fs)
Dim byteArray = br.ReadBytes(CInt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream(byteArray)
Me.PictureBox1.Image = Image.FromStream(ms)
End If
End Using
End Sub