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

你可能感兴趣的文章
Prim算法与Kruskal算法在均匀分布权重图中的性能比较
查看>>
Prim算法在加权连通图中的简单实现
查看>>
Prim算法详解及C代码示例
查看>>
pytorch中让数组显示更多的数字 torch.set_printoptions参数详解 numpy也是这个函数
查看>>
pringBoot Controller接收参数的几种常用方式
查看>>
printf()函数
查看>>