How to make a Self Updating Program in VB
Here you will learn the method, and get the routines for making a real standalone self updating program in VB Net, which you can paste into your program.
The program (your .exe program) checks for updates on shutdown, it then
downloads the new .exe, which is a copy of itself, plus any changes made to it and finally
replaces itself with the new one
How it works
In the form close event, the updatecheck routine is called.
This optionally reads the registry to see if x days have elapsed and if they have
it looks for a text file on the server containing the version number in this format 126.96.36.199 or x.x.x.x
After finding and reading the file, it compares the application version to the new version and if older
it downloads the updated version to its folder and starts it.
The downloaded programs’ name must have a format like “yourprogram Update.exe”
By this time, the old program has quit and the new program is starting up.
In the form load event, the new program checks which name it has.
If its name is “yourprogram Update” then it makes a copy of the original program as .ex
It then deletes the old program and copies itself as “yourprogram.exe” after which it quits.
At the next start up it deletes the update version from the folder
What you will need
To try this out make a windows form
Add a textbox1, add a quit button
A folder on your website with a file called version.ver, containing just 1.0.0.x. The file has the ending .ver so that it doesn’t have caching problems from the server.
Your updated program with a fixed name, i.e the name cannot be different each time because it is a constant in the code.
This is critical to the functioning of the routine.
At the bottom of the code is an alternative version, which is much longer and has very little error catching.
It does however show the downloaded byte count.
You will need to edit all addresses and strings, since they still point to this website