vb.net线程参数 vbnet线程池

vb.net 怎样操作带参数的多线程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
vb.net多线程如何返回参数,举个例子,谢谢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)
【vb.net线程参数 vbnet线程池】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 = https://www.04ip.com/post/30
t.Start()
End Sub
Sub SquareEventHandler(ByVal Square As Double) Handles oSquare.ThreadComplete '响应事件函数
MsgBox("The square is "Square)
End Sub
End Class
VB.NET线程内调用带参数的方法异常报错信息是什么?截图一下 。
---------补充----------------
你这报错与线程应该关系不大吧,是调用COM不熟悉造成的,在项目属性里面有些相关配置你研究研究 。
关于vb.net线程参数和vbnet线程池的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读