Automatic Updates
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
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.
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.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
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)
(sorry for the late bump

but i would just download the .exe and not the whole folder


a few ideas? (A)
Thanks! I understand now how it works! Now my programs will get up to date with your help! Thanks! clapper; cooll; clapper; cooll;
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.
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.
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 !
"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 !
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
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 all
Imports 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
Copyright Information
Copyright © Codenstuff.com 2020 - 2023