

Dim currentVersion, updateVersion as string
Private Sub Updates()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create _
("") ' Url of the hosted .txt file
Dim response As System.Net.HttpWebResponse = request.GetResponse
Dim sr As System****.StreamReader = New System****.StreamReader(response.GetResponseStream())
updateVersion = sr.ReadToEnd
currentVersion = Application.ProductVersion
sr.Close()
If Not currentVersion = updateVersion Then
' What you want to happen if there is an update
else
' What you want to happen if there isn't an update
End If
Public Class myupdater
Dim Web As New System.Net.WebClient
Dim EnteredSerial As String
Dim newVersion As String = ""
Dim Retry As Integer
Private Sub myupdater_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim myVersion As String
myVersion = My.Computer.FileSystem.ReadAllText("C:\mypath\version.txt")
''
newVersion = Web.DownloadString("http://my.url/version.txt")
If Not newVersion.Contains(myVersion) Then
Label1.ForeColor = Color.Red
Label1.Text = "Updating."
If My.Computer.FileSystem.DirectoryExists("C:\mypath\") Then
If My.Computer.FileSystem.FileExists("C:\mypath\my_Tool.exe") Then
IO.File.Delete("C:\mypath\my_Tool.exe")
My.Computer.Network.DownloadFile("http://my.url/my_Tool.exe", "C:\mypath\my_Tool.exe")
'System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
Else
My.Computer.Network.DownloadFile("http://my.url/my_Tool.exe", "C:\mypath\my_Tool.exe")
'System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
End If
If My.Computer.FileSystem.FileExists("C:\mypath\version.txt") Then
IO.File.Delete("C:\mypath\version.txt")
My.Computer.Network.DownloadFile("http://my.url/version.txt", "C:\mypath\version.txt")
'System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
Else
My.Computer.Network.DownloadFile("http://my.url/version.txt", "C:\mypath\version.txt")
'System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
End If
Else
My.Computer.FileSystem.CreateDirectory("C:\mypath\")
My.Computer.Network.DownloadFile("http://my.url/my_Tool.exe", "C:\mypath\my_Tool.exe")
My.Computer.Network.DownloadFile("http://my.url/version.txt", "C:\mypath\version.txt")
'System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
End If
System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
Me.Close()
Else
System.Diagnostics.Process.Start("C:\mypath\my_Tool.exe")
'newVersion.Show()
Me.Close()
End If
Catch Ex As Exception
MsgBox("Ein Fehler ist aufgetreten:" & vbCrLf & Ex.Message)
End Try
End Sub
End Class
Dim Web As New System.Net.WebClient
Dim EnteredSerial As String
Dim newVersion As String = ""
Dim Retry As Integer
Try
Dim myVersion As String
myVersion = My.Computer.FileSystem.ReadAllText("C:\mypath\version.txt")
''
newVersion = Web.DownloadString("http://my.url/version.txt")
If Not newVersion.Contains(myVersion) Then
msgBox("A newer Version is available, the Programm will close now.")
System.Diagnostics.Process.Start("C:\mypath\Updater.exe")
End
End if
End Try