come si procede per andare avanti quando si manifesta una eccezzione in questo codice
codice:
Try
' On Error Resume Next
For i As Integer = 0 To Form1.ListBox2.Items.Count - 1
If remoteDevice.DeviceFileExists(Form1.ListBox2.Items(i)) = True Then
Dim remotedevice As New RAPI
Dim Attribs As RAPI.RAPIFileAttributes
Attribs = RAPI.RAPIFileAttributes.Normal
remotedevice.SetDeviceFileAttributes(Form1.ListBox2.Items(i), Attribs)
remotedevice.CopyFileFromDevice(Application.StartupPath & "\Root\" & Form1.ListBox2.Items(i), Form1.ListBox2.Items(i), True)
Label1.Text = Form1.ListBox2.Items(i)
Label2.Text = remotedevice.GetDeviceFileSize(Form1.ListBox2.Items(i))
Label3.Text = "Copiati: " & i + 1 & " di: " & Form1.ListBox2.Items.Count
PB1.Minimum = 0
PB1.Maximum = Form1.ListBox2.Items.Count
Application.DoEvents()
PB1.Value = i
End If
Next
Catch ex As Exception
'MessageBox.Show(ex.Message)
ListBox1.Items.Add(Label1.Text)
End Try
MessageBox.Show("Il Back-Up è stato eseguito!", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information)