Help with copying xml file from Temp folber to applicaton's folder using VB.NET


How do I copy an xml file from my application's Temp folder to the application main folder using VB.NET?


Who is Participating?
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
how to copy a file in VB (note: a .xml file is nothing else than still a file)
We need the File object:
This just means "System.IO has an object called File. Use this File object".

File has it's own properties and methods you can use. One of these is Copy. Here's some code that makes a copy of our test file .
Dim FileToCopy As String
Dim NewCopy As String

FileToCopy = "C:\Users\Owner\Documents\test.xml"
NewCopy = "C:\Users\Owner\Documents\NewTest.xml"

If System.IO.File.Exists( FileToCopy ) = True Then

System.IO.File.Copy( FileToCopy, NewCopy )
MsgBox("File Copied")

End If

Open in new window

all you need to do is to update the variables in regards to the folders you refer to.
vcharlesAuthor Commented:
Thank You.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.