VB.NET-全局声明一个"WithEvents" [英] VB.NET - Globally declare a 'WithEvents'

查看:234
本文介绍了VB.NET-全局声明一个"WithEvents"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

至于我以这种方式声明的自定义表格;

As for the custom Form i declare it this way;

Dim WithEvents Ev As New MyDll.MyClass



但是,当我尝试公开它时,要在另一个表单上进行工作,则事件"Ev"不会显示在另一个表单上.
我该如何管理呢?我尝试了与共享,公共,朋友...一起玩过的许多选项...



but when i try to public it, to work plus on another Form, the Events "Ev " isnt displayed on the other Form.
How i can manage this i tried many options i played with shared, public, friend...
but with no result, is it even possible?

推荐答案

您只能在方法内部使用Dim.

在您的情况下,在班级上,可以根据需要的可见性删除Dim并将其替换为Public或Private.
You only use Dim inside a method.

In your case, at the class leve, you remove the Dim and replace it with Public or Private depending on the visibility you want.


这篇关于VB.NET-全局声明一个"WithEvents"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆