vb.net线程多个参数 c# 线程用法 带多个参数-成都快上网建站

vb.net线程多个参数 c# 线程用法 带多个参数

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)

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

Vb.net 怎样操作有参数的多线程而且还是循环的。

Sub Main()

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后面去掉括号就行

VB.NET线程内调用带参数的方法异常

报错信息是什么?截图一下。

---------补充----------------

你这报错与线程应该关系不大吧,是调用COM不熟悉造成的,在项目属性里面有些相关配置你研究研究。

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线程多个参数 c# 线程用法 带多个参数
浏览地址:http://kswjz.com/article/hiphpe.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流