博客
关于我
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/

你可能感兴趣的文章
Python 余弦相似度与皮尔逊相关系数 计算
查看>>
python 使用execjs 报编码错误解决办法,UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xac in position 145: il
查看>>
python 使用filetype校验文件
查看>>
Python 使用flush函数将缓冲区数据立即写磁盘
查看>>
python 使用in判断不准确,in不好使
查看>>
Python 使用pandas 进行查询和统计详解
查看>>
Redis 配置文件redis.conf详细解释
查看>>
python网络爬虫(2)——scrapy框架的基础使用
查看>>
python网络爬虫实例教程试读_Python网络爬虫实战教程(全套完整版) - 学途无忧网 - 做技术的王者 - Powered By EduSoho...
查看>>