大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Sub Main()
成都创新互联是专业的江北网站建设公司,江北接单;提供成都网站建设、成都网站设计,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行江北网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
Dim thr As New Thread(AddressOf 循环)
thr.Start("a")
End Sub
Sub 循环(a() As String)
'这里随你干什么循环也行
For Each i As String In a
MsgBox(i)
Next
End Sub
看懂了吧 参数只能有一个 也可以不是数组,在a() As String的a后面去掉括号就行
public class threadclass
{
public int a;
public void threadmethod()
{
//use a;
}
}
...
threadclass tc = new ....
tc.a = 10;
Thread t = new ThreadStart(tc.threadmethod);
t.Start
Public Class Form1
Public Class SquareClass '把多线程调用的函数封装到类中,通过类事件返回
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 '多线程返回值测试,当线程运行完成激发事件
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 '响应事件函数
MsgBox("The square is " Square)
End Sub
End Class
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() //启动多线程进程
Application.DoEvents
Next
End Sub