title: how to run two process at a time in vb.net?
body: <pre><code> Imports System.Threading.Thread
   Public Class Form1
  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      Dim i As Integer
      While i &lt;= 10
          TextBox1.Text = i.ToString()
          TextBox1.Refresh()
          Sleep(1000)
          i = i + 1
      End While
  End Sub
  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Dim lbl As Label
      Dim matches() As Control
      matches = Me.Controls.Find("Label" &amp; TextBox1.Text, True)
      If matches.Length &gt; 0 AndAlso TypeOf matches(0) Is Label Then
          lbl = DirectCast(matches(0), Label)
          lbl.BackColor = Color.Yellow
      End If
  End Sub
  End Class
  </code></pre>
  
  <p>If i click button1 then it is showing 1 to 10 in textbox each after one second. It is working fine. after clicked button1 when textbox.text=2 that time i want to press button2. if i press button2 then it should show the label2.backcolor=yellow. label no is textbox.text. Problem is : After finished while loop in button1 then only i can press button2. we are getting only label10 as yellow color after finished while loop. Solution : I want to click that button2 before ending while loop. Please give solution. Actually i want which number is showing in textbox1.text that label should be yellow color. </p>