SolvedWriting Resources To Disk

Posts 1–5 of 5 · Page 1 of 1
Writing Resources To Disk
Hi mpgh!
I would like to know how to extract some files in the disk C:\ , previously uploaded in the resources of the program.

(Sorry for my bad english, i dont know some words then i use google translater and it's not really good...)

Pls help me!
Code:
My.Computer.FileSystem.WriteAllBytes("C:\Filename.extension",My.Resources.MyResourceName,False)
Replace first parameter with the name of the file you want it to be saved into and replace the second parameter with the name of your resource.
Quote Originally Posted by Hassan View Post
Code:
My.Computer.FileSystem.WriteAllBytes("C:\Filename.extension",My.Resources.MyResourceName,False)
Replace first parameter with the name of the file you want it to be saved into and replace the second parameter with the name of your resource.
Shouldn't you check first if the file exists before you eventually replace it?

Code:
	If My.Computer.FileSystem.FileExists("C:\Filename.extension") Then
           	MsgBox("File exists")
        Else
            Dim myFile As Object = My.Resources.Filename
        		IO.File.WriteAllBytes("C:\Filename.extension", myFile)
        End If
Thanks, i test it.

---------- Post added at 11:58 PM ---------- Previous post was at 11:42 PM ----------

Thanks, it's working!!
Problem solved.

---------- Post added 07-06-2012 at 12:11 AM ---------- Previous post was 07-05-2012 at 11:58 PM ----------

Can you add me on skype? I'm RevengeHelroos
No, because i have to delete all files and then replace these.

---------- Post added at 12:56 PM ---------- Previous post was at 12:10 PM ----------

I need it for a cleaner and for a installer, but thanks for 2nd version of the code!
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?