codice:
Imports System.IO
'...
Dim buffer(4096) As Byte
Dim readByte As Integer
Dim is As FileStream
Dim os As FileStream
Try
File.Copy(txtImmagine.Text, txtFileOutput.Text)
is = New FileStream(txtArchivio.Text, FileMode.Open)
os = New FileStream(txtFileOutput.Text, FileMode.Append)
Do While True
readByte = is.Read(buffer,0,buffer.Length)
If readByte=0 Then Exit Do
os.Write(buffer,0,readByte)
Loop
Catch ex As IOException
'Inserire qui la gestione degli errori di IO
Catch ex As Exception
'Inserire qui la gestione degli altri errori
Finally
If Not (os Is Nothing) Then os.Close()
If Not (is Is Nothing) Then is.Close()
End Catch