vb.net里的delegate的使用,委托使用
来源:互联网 发布:上帝视角的人 知乎 编辑:程序博客网 时间:2024/05/19 17:06
Imports System.NET
Imports System.Threading
Public Class FrmLanPC
Delegate Sub ShowProgressDelegate(ByVal newPos As Integer)
Private Sub ShowProgress(ByVal newPos As Integer)
' 判断是否在线程中访问
If Not Me.InvokeRequired Then
' 不是的话直接操作控件
Me.progressBarSearch.Value = newPos
Else
' 是的话启用delegate访问
Dim showProgressDl As New ShowProgressDelegate(AddressOf ShowProgress)
' 如使用Invoke会等到函数调用结束,而BeginInvoke不会等待直接往后走
Me.BeginInvoke(showProgressDl, New Object() {newPos})
End If
End Sub
Private Sub FrmLanPC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBASE.Load
Dim th As Thread = New Thread(AddressOf InitLanHost)
th.IsBackground = False
th.Name = "SearchLanPC"
th.Start()
End Sub
private sub InITLanHost()
for i =0 as Integer to 100
'...处理其实事务
'用到委托来更新PrgsBar
ShowProgress(i)
next
end sub
End Class
- vb.net里的delegate的使用,委托使用
- .NET delegate 委托的使用
- VB.NET委托的使用
- VB.NET委托的使用
- delegate 委托的使用
- C# 委托(delegate) 的使用
- C# 委托(delegate)的使用
- ASP.NET中"委托"(delegate)的使用简单实例
- 用JScript实现VB.Net,C#的[委托Delegate]:
- 用JScript实现VB.Net,C#的[委托Delegate]:
- 用JScript实现VB.Net,C#的[委托Delegate]:
- 委托控件的使用(Delegate Control)
- C# EventHandler and Delegate(委托的使用)
- C# EventHandler and Delegate(委托的使用)
- C# EventHandler and Delegate(委托的使用)
- C#中Delegate委托的使用
- iOS中delegate(委托)的使用
- IOS -- Delegate委托 的 使用与理解
- Technical Note and Summary of Approach
- 由小波变换想到的
- Redhat 系统中FTP命令应用
- Acknowledgements and Request for Remarks
- Progress and wait notes
- vb.net里的delegate的使用,委托使用
- Part 1. Concepts
- 十大最佳存储实践
- Chapter 1. Basic IP Connectivity
- 内存访问越界
- C#4.0 新特性 dynamic 简化Com调用的复杂度
- 1.1. IP Networking Control Files
- c#中调用JavaScript脚本函数的一种方法
- 1.2. Reading Routes and IP Information