Non si può. Piuttosto sposta il try in modo che comprenda solo il codice che viene ripetuto nel for:
.codice:For i As Integer = 0 To Form1.ListBox2.Items.Count - 1 If remoteDevice.DeviceFileExists(Form1.ListBox2.Items(i)) Then Try 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 Catch ex As Exception ListBox1.Items.Add(Label1.Text) End Try End If Next MessageBox.Show("Il Back-Up è stato eseguito!", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information)

Rispondi quotando