Bom de facto estou a fazer uma ferramenta que transforma uma foto feita upload pelo utilizador em bytes array depois compara esses bites com as fotos existentes na base de dados . Consegui fazer o codigo funcionar mas quando no fim ele detectou alguma igual ou parecida entao mostra essa do untilizador no picturebox 1 e a encontrada na base de dados que neste caso e inserida em uma listbox quando o programa faz load bom quando termina a operação depois de encontrar um match ele da me erro ja tentei varias coisas e nada, O meu erro e: > Out Of Memory esta na função timer1 o meu codigo e Public Class Form3 Dim totalbytes As Integer Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Using fo As New OpenFileDialog 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 byteArea As Byte() byteArea = br.ReadBytes(CInt(fs.Length)) totalbytes = fs.Length br.Close() 'just to show the sample without a fileread error 'be aware not to use a dispose or using here 'it gives a GDI+ error as the stream (not the name) is reused. Dim ms As New IO.MemoryStream(byteArea) PictureBox1.Image = Image.FromStream(ms) End If End Using End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim byteArea As Byte() Using msX As New IO.MemoryStream PictureBox1.Image.Save(msX, Imaging.ImageFormat.Bmp) byteArea = msX.ToArray() End Using Using ms2 As New IO.MemoryStream(byteArea) Me.PictureBox2.Image = Image.FromStream(ms2) End Using Me.PictureBox1.Image = Nothing End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim finfo As New IO.DirectoryInfo("C:\flora") For Each fi In finfo.GetFiles ListBox1.Items.Add(fi.FullName) Next Timer1.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1 ''PictureBox1.Image = Image.FromFile(Me.ListBox1.SelectedItem.ToString()) Dim ffs As New IO.FileStream(ListBox1.SelectedItem, IO.FileMode.Open) Dim bbr As New IO.BinaryReader(ffs) Dim byteArea As Byte() byteArea = bbr.ReadBytes(CInt(ffs.Length)) If ffs.Length = totalbytes Then Timer1.Stop() Dim pict2 As String = ListBox1.SelectedItem.ToString PictureBox2.Image = Image.FromFile(pict2) MsgBox("Resultados Encontrado " + ListBox1.SelectedItem) End If ''MessageBox.Show(fs.Length) bbr.Close() 'just to show the sample without a fileread error 'be aware not to use a dispose or using here 'it gives a GDI+ error as the stream (not the name) is reused. Dim ms As New IO.MemoryStream(byteArea) PictureBox1.Image = Image.FromStream(ms) ''MessageBox.Show(ms.ReadByte) ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1 End Sub End Class