Kill Threads

  • 13 years ago

    I am using VB.NET 2003 windows appln.... In this appplicatn i am creating many threads on a button click.... The code is

        Private Sub Initstart()
            Label5.ForeColor = System.Drawing.Color.Green
            Label5.Text = "Service Running"
            If Listening = False Then
                Dim T As New Thread(AddressOf Listen)
                T.IsBackground = True
                T.Start()
            Else
                Listening = False
            End If
        End Sub

        Private Sub Listen()
            Listening = True
            Listener.Start()
            Do Until Listening = False
                sb.Socket = Listener.AcceptSocket()
                sb.Socket.BeginReceive(sb.Buffer, 0, sb.Buffer.Length,      SocketFlags.None, AddressOf ReceiveCallBack, sb)
            Loop
        End Sub

        Private Sub ReceiveCallBack(ByVal ar As IAsyncResult)
        End Sub


    In another Button click i want to kill all these threads and again go to Listening mod e... How i can do the coding for this
    Anybody plz help

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks