Hack Forums
[.NET] [Simple] Updating System For Your Application - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [Simple] Updating System For Your Application (/showthread.php?tid=360824)



[Simple] Updating System For Your Application - The-One - Apr 10, 2010

Okey, im posting this simple updating system I made.

What are we going to use?
  • Webclient
  • Label
  • If/Else
  • DownloadFile

Ok, in your program put:

Under Class Form1
Code
Dim Version As String = "1.0"

Form1.Load
Code
Label1.text = Version

Next, we need a host for our file, which we use, to upload the .exe and see if theres a update.

Upload a text file to your host with ONLY 2.0 in it.

Now lets check for a update.
Form1.Load // Buton1
Code
Dim NewVersion As String
Dim WebC As New Webclient

Try
NewVersion = WebC.DownloadString("<linktoversion.txt>")
Catch ex As Exception      
NewVersion =  WebC.DownloadString("<linktoversion.txt>") ' Try again most of the times, if it doesnt connect the first time, it will now.
        End Try
If NewVersion = Version Then
Label2.text = "No New Updates"
else
Label2.text = "New Update!"
End If

Ok, so now it checks if there is a update, you will need to update the text file every time you upload a new update.
Now lets make it download

Button2
Code
Dim Webc As New Webclient
If Label2.text = "New Update!" Then
Webc.DownloadFile("<linktournewfile>", "<nameuwantittoget>")
Label2.text = "No New Updates"
End If

I fully wrote this myself, enjoy.


* - xFic - Apr 10, 2010

This will come in handy, thanks.


* - jaBBatheHuTT - Apr 10, 2010

Nice work dude :D
<tooshort>


* - The-One - Apr 10, 2010

Glad you both liked it :)


* - codepoet - Apr 30, 2010

very handy....will add it to my next project


* - REVZ - May 8, 2010

Great tut. Was searching for this.


* - The-One - May 8, 2010

(May 8, 2010 02:12 AM)RevZx Wrote:  Great tut. Was searching for this.

No problem :)


* - Grieveā„¢ - May 8, 2010

Nice work man!

2short


* - The-One - May 8, 2010

(May 8, 2010 04:29 AM)G.LonGas Wrote:  Nice work man!

2short

Enjoy it :)