How To Provide Check For New Updates Feature in Your Software in VB .Net ?

Posted By: KP On November 4, 2009 Under Other, Programming Categories


Check for new software update option is always nice to have in your software. So your users can check for new versions without visiting your website. Here is complete tutorial/code for it. So have online update check for software from your next release.

You can use same logic as below in any programming language but here I am explaining it for VB .Net

Big softwares use own update server because they have users like 100k or more. For smaller software we will just use a PHP file or simple text file.

Basically what we will do is we will put a text or php file on server. the file will have the current version number. If the version number is not matching that means your software have update, redirect user to update link.

To do this take a new form, add a web browser on it. Set webbrowser’s visible property to false.

Now on form load event set web browser to visit your txt file or send current version to a PHP file as query. e.g. update.php?ver=1.0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate(“http://kpsofts.com/yahoomessengerautomater/update.txt”)
End Sub

Now when the document gets loaded , it’s time to compare current and latest version.

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If (WebBrowser1.DocumentText = currentversion) Then
MsgBox(“You have the latest version of the software”)
Else
MsgBox(“An update is available, click ok to download”, MsgBoxStyle.OkCancel)
If (MsgBoxResult.Ok) Then
System.Diagnostics.Process.Start(“http://kpsofts.com/newversion.exe”)
End If

End If
End Sub

Where new version is version of current software, where you can use any variable or any defined version in software meta data.You can use webbrowser1 to navigate to new version instead of launching your download in system default browser.

In PHP file you have to process the query and send download file accordingly to the added web browser which is more advanced.

Now , just give a link to “Check for updates” in the menu of our software and load the created form using

Form1.Show()

Make design and working changes as per your taste, the method/logic will be same.

Tip: Use ProgressBar to make the download look more professional.



Share with Friends ( Sharing is Caring! )


Subscribe For E-mail Notification Of Article Updates

Enter your email address:

NOTICE:
DO NOT FORGET TO CLICK ON THE VERIFICATION LINK AFTER SUBSCRIBING,THE VERIFICATION MAIL WILL BE SENT TO YOU FROM "FeedBurner Email Subscriptions".
( What is this? Why I need to do this?)

Related Posts

Post a Comment

OR