Sinisterly
Tutorial Auto Update Checker [VB.NET] - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: Tutorial Auto Update Checker [VB.NET] (/Thread-Tutorial-Auto-Update-Checker-VB-NET)



Auto Update Checker [VB.NET] - BreShiE - 02-02-2013

This tutorial is created to show you how to make an auto-update checker in Visual Basic.NET.

Right, how this works is by checking a website for a certain string, and if it contains that string, then it'll continue, but if it's something different, it'll open up a link to the new version. Let's get started!

All you have to do is make a few changes to the following code and put it in your Form1_Load:
Code:
Dim webclient as New WebClient Dim Response as webclient.DownloadString("http://yourwebsite.com/update.txt") 'Change this link to one of your choice If Response = "2.0" Then MsgBox("A NEW UPDATE IS AVAILABLE!", vbInformation, "Update") Process.Start("http://yourdownloadlink.com/program.exe") 'Enter your download link here :) End if


Have your text document/html documents or anything as plain text with the text "1.0" (without quotation marks) and whenever you have an update out, just change your document to "2.0" (without quotation marks) and it'll automatically display the message box and open a link to your program. Make sure you have the link of what the program is going to be already in the program when you release it, or this'll be pointless.

Enjoy!


RE: Auto Update Checker [VB.NET] - BreShiE - 02-03-2013

Just cleaned up the codea little bit.


RE: Auto Update Checker [VB.NET] - i0xIllusi0n - 02-06-2013

To make it even better, you could check it against the programs current version and say if the txt version is less than my version, go for it.
And instead of doing Process.Start, you could have a WebClient DownloadFileASync, then when it's done, execute it, and closed the outdated version.

Nevertheless, nice post. Could see this in future VB.net apps.


RE: Auto Update Checker [VB.NET] - SQLi - 03-16-2013

Example of post above, without DownloadFileAsync
Code:
Dim Version As Integer = 1 Private Sub Form1_Load() Handles MyBase.Load Dim Updates As Integer = Integer.Parse((New System.Net.WebClient).DownloadString("http://google.com/version.txt")) If Updates > Version Then System.IO.File.WriteAllBytes("C:\file.exe", (New System.Net.WebClient).DownloadData("http://google.com/file.exe")) End If End Sub



RE: Auto Update Checker [VB.NET] - cxS - 03-17-2013

This is meant to be done asynchronously. And there's no need for the process class here, you should be downloading that file without depending on the default browser. You can download and save the data using the webrequest streams instead.