What's new

[VB] [TUT] How to make an XML updater for your program in VB2008

Kink

Kink

Enthusiast
Messages
66
Reaction score
18
Points
55
Sin$
0
[TUT] How to make an XML updater for your program in VB2008

Credits To: DJEKL
First:

Create a New Vb2008 Project or open one.

Second:
Add 2 textboxes;
Add one Button(optional)

Third:
Double Click on the form so it brings up the coding.

Fourth:
Right at the top before: Public Class Form1(or whatever your form is named) Copy and Paste this:
Imports System.IO
Imports System.Xml
Imports System.Net




Fith:
under the form1_load or button1_Click
add this code:
Dim xml As New XmlDocument()

xml.Load("http://yoursitehere.com/update.xml")

Dim root As XmlElement = xml.DocumentElement

Dim nodes As XmlNodeList = root.SelectNodes("//checkForUpdate")

For Each node As XmlNode In nodes
TextBox2.Text = node("latestVersion").InnerText
Next

TextBox1.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

If TextBox1.Text <> TextBox2.Text Then
If MessageBox.Show("Update found! Would you like to download?", "Update Found", MessageBoxButtons.YesNo) = DialogResult.Yes Then
Dim wc As New WebClient()
wc.DownloadFile("http://www.yoursitehere.com/YourNeweestApp.exe", "latestVersion.exe")
End If

Process.Start(Application.StartupPath & "\latestVersion.exe")
Application.[Exit]()
Else
MessageBox.Show("No updates found.", "No Updates")
End If




Sixth:
now time to create a new xml document:
Open NotePad and copy and paste this:
<?xml version="1.0" encoding="UTF-8"?>
<checkForUpdate>
<latestVersion>1.0.0.0</latestVersion>
</checkForUpdate>



Now after you have done that. you can change the latest version to whatever you want.
Next click save as and name it: update.xml
and click all files instead of .txt.


Seventh:
Now upload that xml document to any file hosting site.


Eighth:
This is what your final code for the project should look like:
Imports System.IO
Imports System.Xml
Imports System.Net

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Dim xml As New XmlDocument()

xml.Load("http://www.yoursitehere.com/update.xml")

Dim root As XmlElement = xml.DocumentElement

Dim nodes As XmlNodeList = root.SelectNodes("//checkForUpdate")

For Each node As XmlNode In nodes
TextBox2.Text = node("latestVersion").InnerText
Next

TextBox1.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

If TextBox1.Text <> TextBox2.Text Then
If MessageBox.Show("Update found! Would you like to download?", "Update Found", MessageBoxButtons.YesNo) = DialogResult.Yes Then
Dim wc As New WebClient()
wc.DownloadFile("http://www.yoursitehere.com/YourNeweestApp.exe", "latestVersion.exe")
End If

Process.Start(Application.StartupPath & "\latestVersion.exe")
Application.[Exit]()
Else
MessageBox.Show("No updates found.", "No Updates")
End If
End Sub
End Class
 
Element18592

Element18592

Trusted Seller
Frame In Gold Stickied Grizzled Veteran
Messages
1,239
Reaction score
683
Points
650
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

:thumbdown: uhm...credits to the member that helped you obtain this....NothingBetter2Do.
 
M

Modded Crazy

Enthusiast
Messages
258
Reaction score
37
Points
85
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

urrrr i still dont get it...
 
T

Thilo

Contributor
Messages
2,774
Reaction score
1,237
Points
375
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

You asked Cali for programming help?

...fail...
 
M

Modded Crazy

Enthusiast
Messages
258
Reaction score
37
Points
85
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

lol :smile:
 
Nothinbeter2do

Nothinbeter2do

Banned
Messages
2,399
Reaction score
536
Points
325
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

Hmm, that tutorial looks familiar...
 
M

Modded Crazy

Enthusiast
Messages
258
Reaction score
37
Points
85
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

Maybe a rip or his own he posted on another site
 
Nothinbeter2do

Nothinbeter2do

Banned
Messages
2,399
Reaction score
536
Points
325
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

Lol, you don't understand. This is basically my tutorial and Cali (or whatever his name is) edited it a little bit.
 
GoldBl4d3

GoldBl4d3

VIP
VIP
Retired
Programmer Mythical Veteran Legendary Veteran
Messages
3,785
Reaction score
1,452
Points
600
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

Im sorry to burst your bubble, but I dont find that way of updating the exe proper.

Try moving the running exe to exename.old

Then download the updated exe as the original exename.exe

Then do: Application.Restart();
 
Nothinbeter2do

Nothinbeter2do

Banned
Messages
2,399
Reaction score
536
Points
325
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

It was mainly just an example. The code that says
Code:
wc.DownloadFile("[URL]http://www.yoursitehere.com/YourNeweestApp.exe[/URL]", "latestVersion.exe")
the "latestVersion.exe" was just an example. You can name it to whatever you want.

Plus, it was never suppose to be a tutorial. It was just an example to help someone else.
 
Kenpachi

Kenpachi

Enthusiast
Messages
411
Reaction score
42
Points
85
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

i needz help with an updater -_<
 
T

Thilo

Contributor
Messages
2,774
Reaction score
1,237
Points
375
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

I am working on a updater class, but its for C#.
 
GoldBl4d3

GoldBl4d3

VIP
VIP
Retired
Programmer Mythical Veteran Legendary Veteran
Messages
3,785
Reaction score
1,452
Points
600
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

lols thilo, get on aim so I can see that model.
 
X

Xxi2GoDLYixX

Newbie
Messages
26
Reaction score
2
Points
45
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

wow way to steal my code this is the same one i posted in vip game-tuts bout a month ago; way to steal:frown:
 
Element18592

Element18592

Trusted Seller
Frame In Gold Stickied Grizzled Veteran
Messages
1,239
Reaction score
683
Points
650
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

Kenpachi said:
i needz help with an updater -_<
Msn or aim acc
 
Kenpachi

Kenpachi

Enthusiast
Messages
411
Reaction score
42
Points
85
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

my aim is KenpachiMoDz
 
Nothinbeter2do

Nothinbeter2do

Banned
Messages
2,399
Reaction score
536
Points
325
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

Xxi2GoDLYixX said:
wow way to steal my code this is the same one i posted in vip game-tuts bout a month ago; way to steal:frown:

LOL. STFU and go back to game-****. I created this and Cali Alec modified it.
 
X

Xxi2GoDLYixX

Newbie
Messages
26
Reaction score
2
Points
45
Sin$
0
Re: [TUT] How to make an XML updater for your program in VB2008

wow are you serious have of his programs are stolen, like his hash bloc calculator, and al the others
 
Element18592

Element18592

Trusted Seller
Frame In Gold Stickied Grizzled Veteran
Messages
1,239
Reaction score
683
Points
650
Sin$
7
Re: [TUT] How to make an XML updater for your program in VB2008

ha i wouldnt doubt it if they were all stolen
 
Top Bottom
Login
Register