真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net線程傳參 C#線程傳遞參數(shù)的方式

vb.net 怎樣操作帶參數(shù)的多線程

public class threadclass

邵武ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!

{

public int a;

public void threadmethod()

{

//use a;

}

}

...

threadclass tc = new ....

tc.a = 10;

Thread t = new ThreadStart(tc.threadmethod);

t.Start

VB.NET線程內(nèi)調(diào)用帶參數(shù)的方法異常

報(bào)錯(cuò)信息是什么?截圖一下。

---------補(bǔ)充----------------

你這報(bào)錯(cuò)與線程應(yīng)該關(guān)系不大吧,是調(diào)用COM不熟悉造成的,在項(xiàng)目屬性里面有些相關(guān)配置你研究研究。

vb.net 如何傳遞類參數(shù)

線程結(jié)束后利用委托生成事件返回,線程應(yīng)用包括傳入和傳出參數(shù)。

Public Delegate Sub ThreadCallback(value As ThreadResult)

Public Class Form1

Private WithEvents _th_1 As Thread_1

Protected Overrides Sub OnLoad(e As System.EventArgs)

Dim value As ThreadObject

value.Index = 1

Me._th_1 = New Thread_1(Me)

Me._th_1.Run(value)

MyBase.OnLoad(e)

End Sub

Private Sub Thread_1_End(sender As Object, e As ThreadEventArgs) Handles _th_1.ThreadEnd

Me.TextBox1.Text = e.Result.Text

End Sub

End Class

Public Class Thread_1

Public Event ThreadEnd(sender As Object, e As ThreadEventArgs)

Private _control As Control

Sub New(control As Control)

Me._control = control

End Sub

Public Sub Run(value As Object)

Dim th As New Threading.Thread(AddressOf ThreadProc)

th.Start(value)

End Sub

Private Sub ThreadProc(obj As Object)

Dim value As ThreadObject = CType(obj, ThreadObject)

Dim result As ThreadResult = Nothing

If value.Index = 1 Then result.Text = "測(cè)試"

Dim callback As New ThreadCallback(AddressOf ThreadInvoke)

_control.Invoke(callback, result)

End Sub

Private Sub ThreadInvoke(value As ThreadResult)

RaiseEvent ThreadEnd(Me, New ThreadEventArgs(value))

End Sub

End Class

Public Structure ThreadObject

Public Index As Integer

'Public Rect As Rectangle

End Structure

Public Structure ThreadResult

Public Text As String

'Public Rect As Rectangle

End Structure

Public Class ThreadEventArgs

Inherits System.EventArgs

Private _result As ThreadResult

Public ReadOnly Property Result As ThreadResult

Get

Return _result

End Get

End Property

Sub New(value As ThreadResult)

Me._result = value

End Sub

End Class


當(dāng)前標(biāo)題:vb.net線程傳參 C#線程傳遞參數(shù)的方式
分享URL:http://weahome.cn/article/higeog.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部