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

你可能感兴趣的文章
Pycharm Pro 2018.2 汉化专业激活破解
查看>>
PyCharm vs VSCode,是时候改变你的 IDE 了!
查看>>
PyCharm 中,“新建”(New)和“新建项目”(New Project)-ChatGPT4o作答
查看>>
PyCharm 代码编辑与调试运行详解
查看>>
Pycharm 出现 instantitaing tests 以及test session starts 的解决方法
查看>>
pytorch 固定随机种子
查看>>
Pycharm 对容器中的 Python 程序断点远程调试
查看>>
Pycharm 常用快捷键大全【快查字典版】
查看>>
Pycharm 常用快捷键大全,全网最全!
查看>>
PyCharm 常用的技巧完全指南
查看>>
PyCharm 快捷键与效率编码详解
查看>>
pycharm 怎么添加python依赖的包, requirements.txt文件如何导入python库
查看>>
PyCharm 插件工具使用
查看>>
PyCharm 搜索与导航栏详解
查看>>
PyCharm 搭建 Selenium + Python 的自动化测试环境
查看>>
PyCharm 数据库操作详解
查看>>
PyCharm 版本与管理详解
查看>>
PyCharm 界面排版详解
查看>>
pycharm 配置qt
查看>>
Pycharm+Django搭建第一个Python Web程序
查看>>