Sub Main() Dim thr As New Thread(AddressOf 循環(huán)) thr.Start("a") End Sub Sub 循環(huán)(a() As String) '這里隨你干什么循環(huán)也行 For Each i As String In a MsgBox(i) Next End Sub
按需策劃可以根據(jù)自己的需求進(jìn)行定制,做網(wǎng)站、網(wǎng)站設(shè)計(jì)構(gòu)思過程中功能建設(shè)理應(yīng)排到主要部位公司做網(wǎng)站、網(wǎng)站設(shè)計(jì)的運(yùn)用實(shí)際效果公司網(wǎng)站制作網(wǎng)站建立與制做的實(shí)際意義
Sub Main()
Dim thr As Thread
For Pi As Integer=0 To 4 //啟用5線程
MulParams =Pi vbTab sFile vbTab dFile vbTab 1 vbTab DelN vbTab cr vbTab cg vbTab cb vbTab IndexI
GlobalParamas(pi)=MulParams .Split(vbTab)
thr=New Thread(AddressOf MyMulThreadCaller)
thr.Start() //啟動(dòng)多線程進(jìn)程
Application.DoEvents
Next
End Sub
Public?Class?Form1
Public?Class?SquareClass?'把多線程調(diào)用的函數(shù)封裝到類中,通過類事件返回
Public?Value?As?Double
Public?Square?As?Double
Public?Event?ThreadComplete(ByVal?Square?As?Double)
Public?Sub?CalcSquare()
Square?=?Value?*?Value
RaiseEvent?ThreadComplete(Square)
End?Sub
End?Class
Dim?WithEvents?oSquare?As?SquareClass
Private?Sub?Button1_Click(sender?As?Object,?e?As?EventArgs)?Handles?Button1.Click?'多線程返回值測(cè)試,當(dāng)線程運(yùn)行完成激發(fā)事件
oSquare?=?New?SquareClass()
Dim?t?As?New?Threading.Thread(AddressOf?oSquare.CalcSquare)
oSquare.Value?=?30
t.Start()
End?Sub
Sub?SquareEventHandler(ByVal?Square?As?Double)?Handles?oSquare.ThreadComplete?'響應(yīng)事件函數(shù)
MsgBox("The?square?is?"??Square)
End?Sub
End?Class