ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 4279

VB.NET Using a Binary File as a resource

by 1UP - 10-10-2016 - 11:32 PM
#1
This was something I used in order to try and keep my programs down to 1 file. Instead of including a seperate file that handled the updating, I simply embedded it into the main program. To do this all I did was make it a resource and when I needed to use it I would write it out to the root directory that the program was in.

To add a file as a resource, right click your project and click properties.
[Image: resource1.png]

Click on the Resources tab. On the top click on strings and select files. Drag and drop the file you want to include as the resource into this window.

[Image: resource2.png]
Click save or save all.

Now when you decide you need to use that file you can write it out to a directory then run it.

Code:
IO.File.WriteAllBytes("./" & "Updater.exe", My.Resources.Updater)
Process.Start("Updater.exe")
Reply
#2
(10-10-2016 - 11:32 PM)1UP Wrote: This was something I used in order to try and keep my programs down to 1 file. Instead of including a seperate file that handled the updating, I simply embedded it into the main program. To do this all I did was make it a resource and when I needed to use it I would write it out to the root directory that the program was in.

To add a file as a resource, right click your project and click properties.
[Image: resource1.png]

Click on the Resources tab. On the top click on strings and select files. Drag and drop the file you want to include as the resource into this window.

[Image: resource2.png]
Click save  or save all.

Now when you decide you need to use that file you can write it out to a directory then run it.

Code:
     
IO.File.WriteAllBytes("./" & "Updater.exe", My.Resources.Updater)
Process.Start("Updater.exe")

Nice tutorial, I will have to try this out. Thanks for sharing. Heart
Are you a guest to this site? Click the image below and sign up today!
[Image: FTYbRmR.gif]
Reply
#3
thanks ~ i want to try~
Reply
#4
im goign to try this and hope it works great work
Reply

Users browsing: 1 Guest(s)