title: Function takes priority over Timer?
body: <p>I am new to vb.net and was wondering why my function (Run_Process) takes priority over the timer? </p>
  
  <p>The timer (which starts the progress bar) runs after the function call even though the timer is set before the function.</p>
  
  <pre><code>                Timer2.Start()
                  ListBox1.Items.Add("Backing up the registry, Please wait as this may take some time...")
                  ListBox1.ForeColor = Color.SlateBlue
                  MsgBox(Run_Process("CMD.exe", "/C regedit.exe /e C:\MMG\Regbackup.Reg"))
                  Timer2.Stop()
                  ListBox1.Items.Clear()
  </code></pre>
  
  <p>The function itself runs a cmd command.</p>
  
  <p>The timer code is </p>
  
  <pre><code>Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick    
      ProgressBar1.Increment(1) 
      If ProgressBar1.Value = 100 And ListBox1.Items.Count() &lt; 1 Then 
          Label1.Text = "Process complete with no obvious threats" 
          Button4.Enabled = False 
          Label1.ForeColor = Color.DarkGreen 
          Button1.Enabled = False 
      End If 
      Label3.Text = ProgressBar1.Value &amp; (" %") 
  End Sub
  </code></pre>