VB.Net 中 WithEvents、AddHandler
来源:互联网 发布:centos 7 nat网络配置 编辑:程序博客网 时间:2024/05/21 11:17
[转自]http://www.cnblogs.com/todd/archive/2008/06/20/1226516.html
Public Class Form1 Dim WithEvents cls1 As New ClassTest() 'WithEvents方式 Dim cls2 As New ClassTest() 'AddHandler方式 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cls1.Test() 'WithEvents方式 AddHandler cls2.GetValue, AddressOf cls2GetValue 'AddHandler方式 cls2.Test() Me.Close() End Sub Private Sub cls1_GetVale(ByVal str As String) Handles cls1.GetValue 'WithEvents方式 MsgBox("cls1 " & str) End Sub Private Sub cls2GetValue(ByVal str As String) 'AddHandler方式 MsgBox("cls2 " & str) End SubEnd ClassPublic Class ClassTest Public Event GetValue(ByVal str As String) Public Sub Test() RaiseEvent GetValue("事件例子") End SubEnd Class
Result:
cls1 事件例子
cls2 事件例子
- VB.Net 中 WithEvents、AddHandler
- VB.Net 中 WithEvents、AddHandler
- 在vb.net 中 WithEvents 的作用
- VB.NET中AddHandler使用demo
- 【转】VB.net是怎样做到的——Handles和WithEvents
- WithEvents
- 关于VB中的WithEvents关键字理解
- [VB.NET]vb.net中 listbox 问题
- vb.net 学习中..
- VB.NET中Module
- VB.NET中四舍五入
- VB中调用VB.NET包装类
- VB.NET中生成缩略图
- vb.net中应用 ArrayList
- VB.NET中访问注册表
- VB.NET中应用 StringWriter
- VB.NET中使用Log4Net
- VB.Net中使用Sendkeys
- File and directory.
- 怎么申请google map api-key
- 计算机时间同步系统RS232接口
- 2011 regional Beijing Site A —— Qin Shi Huang's National Road System
- 将你的Android手机相机做摄像头
- VB.Net 中 WithEvents、AddHandler
- NTP网络时间服务器
- 如何制作ROM
- oracle 修改 clob字段,查询clob字段
- js下载activex
- Android系统内存扫盲点
- GPS 精确时钟服务器
- 银监会
- ROM制作教程 如何创建一个刷机包