title: Auto Update Function in Vb.net
body: <p>Ok I got this code from Gemster from <a href="http://tech.reboot.pro/showthread.php?tid=2982" rel="nofollow">http://tech.reboot.pro/showthread.php?tid=2982</a>. So I just looked for something to plug into my system as it need to be done asap. So I copied and pasted. However, I do understand what is going on. The only problem is that it skips over a section of important code and I can't figure out why. So here it is.</p>
  
  <pre><code> Dim CurrentVersion As String = My.Application.Info.Version.ToString '--- Change this to Current version, needs changing on every update
      Dim ProgramName As String = My.Application.Info.AssemblyName '--- Change this to Your Program Name
      Dim SiteName As String = "http://somewebsite.com/UpdateVersion.html" '--- Change this to Your Update page
      Dim VersionCHK As String = ""
      Dim GetVer As String = ""
      Dim GetVerLink As String = ""
      Dim GetUpd As Integer
  
      'Web Request
      Dim WebRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(SiteName)
      Dim WebResponse As System.Net.HttpWebResponse = WebRequest.GetResponse
      Dim STR As System.IO.StreamReader = New System.IO.StreamReader(WebResponse.GetResponseStream())
      Dim ReadSource As String = Str.ReadToEnd
      Dim Regex As New System.Text.RegularExpressions.Regex(ProgramName &amp; "=(\d+).(\d+)=(.*?).zip")
      Dim matches As MatchCollection = Regex.Matches(ReadSource)
  </code></pre>
  
  <p>This is the part that it skips the 'Split String' for each statement</p>
  
  <pre><code>    'Split String
      For Each match As Match In matches
          Dim RegSplit() As String = Split(Match.ToString, "=")
          GetVer = RegSplit(1)
          GetVerLink = RegSplit(2)
      Next
  </code></pre>
  
  <p>This is where it picks back up.</p>
  
  <pre><code>    'Check Verison
      If GetVer &gt; CurrentVersion Then
          GetUpd = MsgBox(ProgramName &amp; " is an old version." &amp; vbCrLf &amp; "New Update is available" &amp; _
          vbCrLf &amp; "Current version: " &amp; CurrentVersion &amp; vbCrLf &amp; "Version Avalible: " &amp; _
          GetVer &amp; vbCrLf &amp; vbCrLf &amp; "Update Now?", vbYesNo, "Update")
  
          If GetUpd = vbYes Then
              Dim sfd As New SaveFileDialog
              sfd.FileName = IO.Path.GetFileName(GetVerLink)
              If sfd.ShowDialog = DialogResult.OK Then
                  My.Computer.Network.DownloadFile(GetVerLink, sfd.FileName)
              End If
          End If
      Else
          MsgBox(ProgramName &amp; " is upto date." &amp; vbCrLf &amp; "Current version: " &amp; CurrentVersion, 0, "Update")
      End If
      Return vbNull
  </code></pre>
  
  <p>Any ideas why? Thanks in advance. </p>