Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

VS 2012 Progress Bar Load issue

$
0
0
Hey,

Guys i need help im trying to make a progress bar that loads second form but also check for a update

This is my check for update code

Code:


  Public Sub CheckForUpdates()

        Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.link.com/update.txt")

        Dim response As System.Net.HttpWebResponse = request.GetResponse()
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
        Dim newestversion As String = sr.ReadToEnd()
        Dim currentversion As String = Application.ProductVersion
        Dim chup As New WebClient
        Dim upver As String = chup.DownloadString("http://www.link.com/update.txt")
        If upver.Contains(currentversion) Then
        Else
            MsgBox("There is a new update we will download it now for you.")
            System.Diagnostics.Process.Start("http://link.com/download.zip")
            Application.Exit()
        End If

This the code for my Form1 Load

Code:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      CheckForUpdates()
 Timer1.Enabled = True

        Timer1.Interval = 800  ' 0.1 second

        ProgressBar1.Maximum = 3000 ' 3000 means 3 seconds
    End Sub

Code:

  Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        ProgressBar1.Value += 200

        If ProgressBar1.Value = ProgressBar1.Maximum Then

            Timer1.Enabled = False

            Form2.Show()
            Me.Hide()
        End If
    End Sub

Can anybody help me fix this what it dose is the progress bar gos half way up then form2 opens in form1 closes i want it to finish the progress bar then close form1 in open form 2

Viewing all articles
Browse latest Browse all 27355

Trending Articles