以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  子线程传参  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=89395)

--  作者:chenjiu6202
--  发布时间:2016/8/20 19:14:00
--  子线程传参

如果子线程Public Function PushUpdate(ByVal ActionType As String) As String

定义的一个函数,调用函数执行子线程,怎样把参数带进去


--  作者:大红袍
--  发布时间:2016/8/21 14:53:00
--  

 启动线程的时候,可以带上一个对象的。

 

如果

 

Dim ary() As string = {"bartend.exe", "D:\\机油泵程序\\公司条码.btw"}

Dim nthread As New System.Threading.Thread(AddressOf thread_sub1)
nthread.start(ary)

 

 


--  作者:chenjiu6202
--  发布时间:2016/8/23 16:13:00
--  

袍哥,帮我看看哪里不正确

在全局代码里的

Public Sub PushUpdateAry(ByVal ActionType As String,ByVal DataTableName As String,ByVal IdNUM As String)
Dim msg As String = ActionType & "#" & DataTableName & "#" & IdNUM
For Each bd As QQBuddy In QQClient.Buddies
    If bd.Online Then
        QQClient.Send(bd.name, msg)
    End If
Next
\'Return msg
End Sub

 

 

DataColChanged里面写的下面这个

 

Dim p As String = IIF(e.DataRow.RowState = DataRowState.Added, "A", "U")
            Dim ary() As String = {p,"人员表",e.DataRow("_Identify")}
            Dim nthread As New System.Threading.Thread(AddressOf PushUpdateAry)
            nthread.start(ary)
现在是不能通过编译,或者提示错误“不是委托的线程”


--  作者:大红袍
--  发布时间:2016/8/23 16:17:00
--  

Public Sub PushUpdateAry(ByVal ActionType As String,ByVal DataTableName As String,ByVal IdNUM As String)

Dim msg As String = ActionType & "#" & DataTableName & "#" & IdNUM

改成

 

Public Sub PushUpdateAry(ByVal ary As Object)

Dim msg As String = ary(0) & "#" & ary(1) & "#" & ary(2)

 

 


--  作者:chenjiu6202
--  发布时间:2016/8/24 9:45:00
--  
谢谢袍哥,已经好了,感谢!