You will find a Source Code Project download attached to the bottom of this post.
Difficulty: Beginner
Controls that are needed:
1 x Label named "Label1"
1 x Label named "Label2"
1 x CommandButton named "cmdUpdate"
1 x Microsoft Internet Transfer Control named "Inet1" (Press CTRL + T and scroll down the list to add this control to your project)
Resources needed:
A server you can upload .txt files to.
Step 1.
Upload a .txt file to your server with a version number in it. (1.0 for example)
Step 2.
Copy and paste this code to your Form. (be sure to fill out the Private Constants correctly)
Step 3.
Run and test your program.
Difficulty: Beginner
Controls that are needed:
1 x Label named "Label1"
1 x Label named "Label2"
1 x CommandButton named "cmdUpdate"
1 x Microsoft Internet Transfer Control named "Inet1" (Press CTRL + T and scroll down the list to add this control to your project)
Resources needed:
A server you can upload .txt files to.
Step 1.
Upload a .txt file to your server with a version number in it. (1.0 for example)
Step 2.
Copy and paste this code to your Form. (be sure to fill out the Private Constants correctly)
Code:
Option Explicit
Private Const strCurrentVersion As Double = "0.1"
Private Const strVersionURL As String = "Path_To_Version_Here"
Private Const strDownloadURL As String = "Path_To_File_Here"
Private Sub cmdUpdate_Click()
Dim strLatestVersion As Double
If Inet1.StillExecuting = True Then
Exit Sub 'If the inet1 control is busy than exit the sub (prevents stillexecuting error)
End If
cmdUpdate.Enabled = False
strLatestVersion = Val(Inet1.OpenURL(strVersionURL))
Label1.Caption = "Current version: " & strCurrentVersion
Label2.Caption = "Latest version: " & strLatestVersion
If Val(strLatestVersion) > Val(strCurrentVersion) Then
If MsgBox("An update is available." & vbNewLine & "Your version: " & strCurrentVersion & vbNewLine & "Latest version: " & strLatestVersion & vbNewLine & vbNewLine & "Would you like to update now?", vbQuestion Or vbYesNo, "Update Now?") = vbYes Then
'launch update using the strDownloadURL constant
Else
'did not want to update
End If
End If
cmdUpdate.Enabled = True
End Sub
Step 3.
Run and test your program.



