Hello,
I'm trying to get Vb.net to move a file selected from an openfiledialog.
This is what I have so far:
Dim FileToMove As String
Dim MoveLocation As String
FileToMove = openFD.FileName
MoveLocation = folderbrowser.SelectedPath
If System.IO.File.Exists(FileToMove) = True Then
System.IO.File.Move(FileToMove, MoveLocation)
MsgBox("File Moved")
End If
What I need to do is cut out just the file name from the openFD.FileName from the rest of the path, and attach it to the SelectedPath so I can move the file. What do I need to do?
Thanks,
AW
Loading
PJ MartinsPosted Jun 29, 2010, 9:12 PM
Dim finf as new FileInfo(FileToMove)
System.IO.File.Move(FileToMove, MoveLocation & "\" & finf.Name)
CrishPosted Nov 30, 2010, 2:06 AM
AnatolePosted Jun 30, 2010, 9:34 AM
AnatolePosted Jun 30, 2010, 8:08 AM
I put in that, but I get an error - type Fileinfo isn't defined. I'm running VB 2003. Do I have to add a reference?