0% found this document useful (0 votes)
35 views2 pages

Auto Updater Codes v2

This code checks for updates to an application by making a request to a remote server, comparing the current version to the newest version found, and either notifying the user they are up to date or initiating an update download. It uses a progress bar to display the check status and timers to increment the progress bar over time until completion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Auto Updater Codes v2

This code checks for updates to an application by making a request to a remote server, comparing the current version to the newest version found, and either notifying the user they are up to date or initiating an update download. It uses a progress bar to display the check status and timers to increment the progress bar over time until completion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 2

Public Sub CheckForUpdates()

If ProgressBar1.Value = 100 Then


Dim request As System.Net.HttpWebRequest =
System.Net.HttpWebRequest.Create("http://dl.dropbox.com/u/46370133/Noter/Version.t
xt.txt")
Dim response As System.Net.HttpWebResponse = request.GetResponse()

Dim sr As System.IO.StreamReader = New


System.IO.StreamReader(response.GetResponseStream())

Dim newestversion As String = sr.ReadToEnd()


Dim currentversion As String = Application.ProductVersion
If newestversion.Contains(currentversion) Then
Button1.Text = ("You are up todate!")
label2.text = ("You may now close this dialog")
Else
Button1.Text = ("Downloading update!")

WebBrowser1.Navigate("http://dl.dropbox.com/u/46370133/Noter/Noter.exe")
label2.text = ("You may now close this dialog")
End If
End If

Button

Button1.Enabled = False
Button1.Text = "Checking for updates..."
Timer1.Start()
Label1.Text = ProgressBar1.Value
CheckForUpdates()

timer

ProgressBar1.Increment(5)
Label1.Text = ProgressBar1.Value
If ProgressBar1.Value = 100 Then
Timer1.Stop()

If ProgressBar1.Value = 100 Then


Dim request As System.Net.HttpWebRequest =
System.Net.HttpWebRequest.Create("http://dl.dropbox.com/u/46370133/Noter/Version.t
xt.txt")
Dim response As System.Net.HttpWebResponse =
request.GetResponse()

Dim sr As System.IO.StreamReader = New


System.IO.StreamReader(response.GetResponseStream())

Dim newestversion As String = sr.ReadToEnd()


Dim currentversion As String = Application.ProductVersion
If newestversion.Contains(currentversion) Then
Button1.Text = ("You are up todate!")
label2.text = ("You may now close this dialog")
Else
Button1.Text = ("Downloading update!")
WebBrowser1.Navigate("http://dl.dropbox.com/u/46370133/Noter/Noter.exe")
label2.text = ("You may now close this dialog")
End If
End If
End If

You might also like