Page 7 of 11
Re: Automatic Updates
Posted: Tue Aug 24, 2010 6:44 pm
by CodenStuff
Hello V-Light,
The 2 html files are for the updated exe file location and the new version number.
Inside updatedownload.html you need to write the location of your updated exe file on your webhost like:
http://www.YOURSITE.com/ThisIsMyUpdated.exe
And in version.html you need to write the new version number like:
v1.2
Then upload them both to your webhost.
Re: Automatic Updates
Posted: Tue Aug 31, 2010 9:45 am
by Axel
hey codenstuff ,
(sorry for the late bump
)
but i would just download the .exe and not the whole folder
for example , you have the gecko webbrowser (21megabyte for the gecko folder) then i would just download the exe and replace it
if you have new components in it then just zip and unzip:D
a few ideas? (A)
Re: Automatic Updates
Posted: Thu Oct 07, 2010 1:29 am
by Bogoh67
pretty cool although there are easier to do it
Re: Automatic Updates
Posted: Sat Nov 06, 2010 2:12 pm
by Vikhedgehog
Thanks! I understand now how it works! Now my programs will get up to date with your help! Thanks! clapper; cooll; clapper; cooll;
Re: Automatic Updates
Posted: Sat Nov 06, 2010 7:59 pm
by XTechVB
cool i'm gonna use this
Re: Automatic Updates
Posted: Sun Nov 07, 2010 8:45 pm
by bisnes_niko
Incase you forgot that long-ish gethttprequest; you can use a WebClient with DownloadString("url")
dim strVer as String = WebClient1.DownloadString("
www.yoursite.com/updates/ver.txt")
And, incase your "something.html" is at private FTP Folder, you might wanna add piece of code to prevent error "Not logged in"
WebClient1.Credentials = New Net.NetworkCredential("username", "password")
That's just one of the many ways...
If you are not using DownloadFileASync(), then you should give try for Multi-Threading to remove the freezing of your app... for an example you're using My.computer.network.Downloadfile(), it will freeze your app till it downloaded the program.
Re: Automatic Updates
Posted: Mon Nov 29, 2010 12:50 am
by thapriceless
great tut learned a lot thanks
Re: Automatic Updates
Posted: Tue Dec 14, 2010 6:53 pm
by M1z23R
You don't have to put richtextbox on the form, nor you have to make it invisible, just add this at the beginning of the code :
"Dim RichTextBoxForUpdate as NEW richtextbox"
and that is all xD
you can call it what ever you want, but in the following code, use the same !
Re: Automatic Updates
Posted: Tue Jan 11, 2011 4:23 pm
by HarrySeddon
This is what i needed
Re: Automatic Updates
Posted: Thu Mar 17, 2011 5:20 pm
by marve25
i need help, when i run the updater then it says "There was a problem downloading the update, please try again later."
i have tried running it as administrator, but it only shows the same.
and im a little confused were to put the two URLs.
heres the code
Code: Select allImports System.Net.webclient
Imports System.IO
Imports System.net
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim url As String = "https://sites.google.com/site/tvilsommeforetak/software/updatedownload.html"
Dim pageRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim pageResponse As WebResponse = pageRequest.GetResponse()
Dim page As String = ""
Using r As New StreamReader(pageResponse.GetResponseStream())
page = r.ReadToEnd()
End Using
Dim WebUpdate As System.Net.WebClient
WebUpdate = New System.Net.WebClient()
AddHandler WebUpdate.DownloadProgressChanged, AddressOf OnDownloadProgressChanged
AddHandler WebUpdate.DownloadFileCompleted, AddressOf OnFileDownloadCompleted
WebUpdate.DownloadFileAsync(New Uri(page), Application.StartupPath & "\Updated.exe")
End Sub
Private Sub OnDownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs)
Dim totalSize As Long = e.TotalBytesToReceive
Dim downloadedBytes As Long = e.BytesReceived
Dim percentage As Integer = e.ProgressPercentage
ProgressBar1.Increment(percentage)
End Sub
Private Sub OnFileDownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
If e.Cancelled Then
ElseIf Not e.Error Is Nothing Then
MsgBox("There was a problem downloading the update, please try again later.")
Else
If My.Computer.FileSystem.FileExists(Application.StartupPath & "\Tick-Tock.exe") Then
My.Computer.FileSystem.DeleteFile(Application.StartupPath & "\Tick-Tock.exe", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
End If
If My.Computer.FileSystem.FileExists(Application.StartupPath & "\Updated.exe") Then
My.Computer.FileSystem.RenameFile(Application.StartupPath & "\Updated.exe", "Tick-Tock.exe")
End If
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If My.Computer.FileSystem.FileExists(Application.StartupPath & "\Tick-Tock.exe") Then
System.Diagnostics.Process.Start(Application.StartupPath & "\Tick-Tock.exe")
Me.Close()
End If
End Sub
End Class