bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

包含vb.net委托參數的詞條

vb.net 給委托的函數傳遞參數

兩個參數:一個是數組名,一個是傳遞的長度

10年積累的成都網站制作、網站設計經驗,可以快速應對客戶對網站的新想法和需求。提供各種問題對應的解決方案。讓選擇我們的客戶得到更好、更有力的網絡服務。我雖然不認識你,你也不認識我。但先制作網站后付款的網站建設流程,更有宜秀免費網站建設讓你可以放心的選擇與我們合作。

Function thename(ByVal imgFrom As Image) As String

thename = imgFrom.Name

End Function

Private Sub Image1_Click()

MsgBox thename(Image1)

End Sub

vb.net 中在模塊(module)里如何實現委托

委托三個步驟

1、聲明委托 用Delegate 聲明一個委托 類型 參數要和 被委托的方法一樣 例如 Delegate Function a(byval x as string) as string

2、實例化委托 dim t as new a(AddressOf Function Name)

3.通過 t(參數) 或者 t.Invoke(參數調用委托)

示例:

Module module1

Delegate Function a(ByVal x As Integer, ByVal y As Integer) As Integer '聲明委托類型 委托可以使一個對象調用另一個對象的方法

Function sum(ByVal x As Integer, ByVal y As Integer) As Integer

Return (x + y)

End Function

Sub main()

Dim d As New a(AddressOf sum) '實例化委托

Dim s = 0

s = d.Invoke(1, 2) '執行委托

Console.WriteLine(s.ToString())

s = d(1, 2) '執行委托

Console.WriteLine(s.ToString())

MsgBox("")

End Sub

End Module

vb.net 如何傳遞類參數

線程結束后利用委托生成事件返回,線程應用包括傳入和傳出參數。

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 = "測試"

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

網頁名稱:包含vb.net委托參數的詞條
標題網址:http://vcdvsql.cn/article16/dosdedg.html

成都網站建設公司_創新互聯,為您提供小程序開發、移動網站建設網站建設App設計ChatGPT微信小程序

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都做網站