ho risolto in questo modo (ho anche sostituito la listbox con una checkbox, x comodità)
codice:Dim numero As Integer = CheckedListBox1.CheckedItems.Count() - 1 For riga = 0 To numero Dim oggetto As String = CheckedListBox1.CheckedItems(riga) If oggetto.Contains("_") Then Dim RP As String = Replace(oggetto, "_", " ") Me.ListBox2.Items.Add(RP) Dim Path2 As String = System.IO.Path.GetDirectoryName(OFD.FileName) Dim Path3 As String = Path2 & "\" & oggetto My.Computer.FileSystem.RenameFile(Path3, RP) Else 'MessageBox.Show("Simbolo mancante in un file, controllare e riprovare!") GoTo line1 End If Next

Rispondi quotando