How i can replace a file

Post your questions regarding programming in Visual Basic 6 in here.
3 posts Page 1 of 1
Contributors
User avatar
krisis
Just Registered
Just Registered
Posts: 3
Joined: Sat Oct 17, 2009 10:49 am

How i can replace a file
krisis
How i can replace a file whit another file ,whit same name and from my resources folder
please Help!!!
Last edited by krisis on Sun Nov 01, 2009 10:02 am, edited 1 time in total.
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: How i can replace a file
CodenStuff
Hello,

Once youve added your file to resources make sure that in your code you import:
Code: Select all
Imports System.IO
Then inside a "Button_Click" event or however your going to extract the file add this code:
Code: Select all
File.WriteAllBytes("C:\NameOfFile.ext", My.Resources.NameOfResourceFile)
And thats it cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
krisis
Just Registered
Just Registered
Posts: 3
Joined: Sat Oct 17, 2009 10:49 am

Re: How i can replace a file
krisis
thx you are the best
i love codenstuff.com
3 posts Page 1 of 1
Return to “General coding help”