JBTALKS.CC

标题: Multi Thread(s) in vb.net [打印本页]

作者: goodhermit95    时间: 2009-6-1 11:51 AM
标题: Multi Thread(s) in vb.net
Imports System.Threading
...
' This value is incremented by all threads.
Public Value As Integer = 0

Private Sub btnStartThread_Click(ByVal sender As _
    System.Object, ByVal e As System.EventArgs) Handles _
    btnStartThread.Click
    ' Make a new counter object.
    Static thread_num As Integer = 0
    Dim new_counter As New Counter(Me, thread_num)
    thread_num += 1

    ' Make a thread to run the object's Run method.
    Dim counter_thread As New Thread(AddressOf _
        new_counter.Run)

    ' Make this a background thread so it automatically
    ' aborts when the main program stops.
    counter_thread.IsBackground = True

    ' Start the thread.
    counter_thread.Start()
End Sub

http://www.vb-helper.com/howto_net_run_threads.html




欢迎光临 JBTALKS.CC (https://jbtalks.my/) Powered by Discuz! X2.5