博客
关于我
VB.NET学习笔记:事件处理及自定义事件
阅读量:257 次
发布时间:2019-03-01

本文共 1175 字,大约阅读时间需要 3 分钟。

VB.NET??????????

1. ??????

?VB.NET????????????????????????????????????????????????????????????????????????? Handles ????

2. ?????????

??????????????????????????????????????????????????????????????????

3. ????????

3.1 ??????

???? Delegate ????????????

Public Delegate Sub CustomEventHandler(ByVal str As String)

3.2 ???????

????????

Public Event CustomEvent As CustomEventHandler

3.3 ??????

??????????????

Public Event CustomEvent(ByVal str As String)

4. ???????

???????????? RaiseEvent ????

RaiseEvent CustomEvent("Hello world")

???????????????

5. ????????

???? Public Sub ????????

Public Sub talk(ByVal str As String)    Me.TextBox1.Text = strEnd Sub

6. ???????

?????? WithEvents ????????????

Public WithEvents Custom As New ClsCustomEvent()

? Load ????????

Custom.RaiseCustomEvent("Hello world")

?????????

Public Sub talk(ByVal str As String) Handles Custom.CustomEvent    Me.TextBox1.Text = strEnd Sub

7. ????????

?? AddHandler ? RemoveHandler ????

AddHandler Custom.CustomEvent, AddressOf talkRemoveHandler Custom.CustomEvent, AddressOf talk

8. ????

  • ????????????
  • ?? WithEvents ????????????????
  • ?? AddHandler ? RemoveHandler ????????????

??????????VB.NET??????????????????

转载地址:http://srjt.baihongyu.com/

你可能感兴趣的文章
PHP获取IP所在地区(转)
查看>>
PHP获取IP的方法对比
查看>>
php获取json里面内容
查看>>
R2的版本由来
查看>>
PHP获取图片宽度高度、大小尺寸、图片类型、用于布局的img属性
查看>>
PHP获取当前文件的绝对路径
查看>>
PHP获取当前时间、时间戳的各种格式写法汇总
查看>>
PHP获取当前页面的完整URL
查看>>
php获取数据库中数据生成json,中文乱码问题的解决方案
查看>>
php获取文件夹中文件的两种方法
查看>>
PHP获取日期的一些方法总结
查看>>
R2学习记录
查看>>
PHP获取本周的每一天的时间
查看>>
php获取用户真实IP和防刷机制
查看>>
php获取网页内容的三种方法
查看>>
R-CNN算法优化策略
查看>>
PHP规范PSR0和PSR4的理解
查看>>
php解析ipa包,获取logo
查看>>
R&Rstudio安装各种包
查看>>
php设置cookie,在js中如何获取
查看>>