'm having some problems, can't findout what is problem with my Update system. I'm using XML file for it. What I'm trying is to get application to read xml file for updates(like some news system) and to get updating application if there is new version. I added already on top of project ReadOnly _reader As XmlReader = XmlReader.Create("C:\launchernews.xml") Still update system doesnt work, but news system does.

Here is code of it:

Public Sub AutoUpdate()
    Dim CurrentVersion As String = My.Application.Info.Version.ToString 
    Dim ProgramName As String 
    Dim GetVer, GetVerLink As String
    Dim GetUpd As Integer

    Using _reader
        While _reader.Read()
            ' Check for start elements.
            If _reader.IsStartElement() Then
                If _reader.Name = "application" Then
                    Dim attribute As String = _reader("name")
                    If attribute IsNot Nothing Then
                        ProgramName = attribute
                    End If
                    ' Text data.
                    If _reader.Name = "version" Then
                        Dim version As String = _reader("name")
                        If version IsNot Nothing Then
                            GetVer = version
                            If _reader.Read() Then
                                GetVerLink = _reader.Value.Trim()
                            End If
                        End If
                    End If
                End If
            End If
            If GetVer > CurrentVersion Then
                GetUpd = MsgBox(ProgramName & " is an old version." & vbCrLf & "New Update is available" & _
                vbCrLf & "Current version: " & CurrentVersion & vbCrLf & "Version Avalible: " & _
                GetVer & vbCrLf & vbCrLf & "Update Now?", vbYesNo, "Update")
                If GetUpd = vbYes Then
                    Dim sfd As New SaveFileDialog

                    sfd.FileName = IO.Path.GetFileName(GetVerLink)
                    If sfd.ShowDialog = True Then
                        My.Computer.Network.DownloadFile(GetVerLink, sfd.FileName)
                    End If
                End If
            Else
                MsgBox(ProgramName & " is upto date." & vbCrLf & "Current version: " & CurrentVersion, 0, "Update")
            End If
        End While
    End Using
End Sub

Here is XML file:

<?xml version="1.0" encoding="UTF-8"?>
<Launcher>
  <news name="Latest Updates">
 We thank you for your patience throughout this update.
    </news>
  <application name="Launcher">
  <version name="1.0.0.0">
  </version>
  </application>
</Launcher>

Recommended Answers

All 2 Replies

Hi,
Does your XML file only contain one entry for the Launcher? and the Launcher can only have one application and name entry?

Also in your code you have GetVerLink = _reader.Value.Trim() on your Version entity but I don't see a value entry just a name attribute.

It needs to have 3 different files to download one by one :/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.