S
Starbuck
Gi
The code below is designed to rename a picture file,
The first part works, the new file is created, the second part (delete old
file) comes up with a file in use error.
Any thoughts please
If List1.Text = "" Then Exit Sub
Dim t As New InputDialog
Dim oldName As String = List1.Text
Dim newName As String = t.InputBox("Enter New Name", "Photo Rename", "")
If newName <> "" Then
'first check for extension, which will be jpg
newName = newName.ToUpper
Dim exten As String = cf.right(oldName, 4)
If exten.ToUpper <> ".JPG" Then oldName = oldName & ".JPG"
exten = cf.right(newName, 4)
If exten.ToUpper <> ".JPG" Then newName = newName & ".JPG"
Dim fi As New FileInfo(tPath & oldName)
fi.CopyTo(tPath & newName)
fi.Delete()
Reg_txt_Change()
End If
Thanks in advance
The code below is designed to rename a picture file,
The first part works, the new file is created, the second part (delete old
file) comes up with a file in use error.
Any thoughts please
If List1.Text = "" Then Exit Sub
Dim t As New InputDialog
Dim oldName As String = List1.Text
Dim newName As String = t.InputBox("Enter New Name", "Photo Rename", "")
If newName <> "" Then
'first check for extension, which will be jpg
newName = newName.ToUpper
Dim exten As String = cf.right(oldName, 4)
If exten.ToUpper <> ".JPG" Then oldName = oldName & ".JPG"
exten = cf.right(newName, 4)
If exten.ToUpper <> ".JPG" Then newName = newName & ".JPG"
Dim fi As New FileInfo(tPath & oldName)
fi.CopyTo(tPath & newName)
fi.Delete()
Reg_txt_Change()
End If
Thanks in advance