这句C#代码怎么翻译成VB?

lcht1 2005-11-09 11:36:52
public event ExceptionEventHandler ExceptionOccurrs; //发生异常事件

if (this.ExceptionOccurrs != null)
{
}
...全文
203 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
真相重于对错 2005-11-10
  • 打赏
  • 举报
回复
C# 一般这个if之间放构造System.EveentArg 之类的变量类似于
if (this.ExceptionOccurrs != null)
{
System.EventArg e = new System.EventArg();
ExceptionOccurrs( this , e );
}
vb.net

应该直接
Dim e as new EventArg
RaiseEvent ExceptionOccurrs( me , e );
lcht1 2005-11-09
  • 打赏
  • 举报
回复
而且我也不明白这句话是什么意思,判断事件ExceptionOccurrs是否为空,检查事件是否被引发吗?
lcht1 2005-11-09
  • 打赏
  • 举报
回复
还是不行

ExceptionOccurrs 下面有虚线,提示"Event ExceptionOccurrs As ExceptionEventHandler (sender,e)是事件,不能直接调用,请使用"RaiseEvent"语句来引发事件
jxufewbt 2005-11-09
  • 打赏
  • 举报
回复
Event ExceptionOccurrs As ExceptionEventHandler '发生异常事件

If Not (Me.ExceptionOccurrs Is Nothing) Then

End If
lcht1 2005-11-09
  • 打赏
  • 举报
回复
不行,ExceptionOccurrs 是事件,系统提示必须使用RaiseEvent来引发事件,但我就是不明白事件引发后,怎么来判断其是否为空
Qqwwee_Com 2005-11-09
  • 打赏
  • 举报
回复
看看。。

public withevent ExceptionOccurrs as ExceptionEventHandler //发生异常事件

if not me.ExceptionOccurrs is nothing


end if




====CSDN 小助手 V2.5 2005年11月05日发布====
CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/11/05/523395.aspx
下载:http://szlawbook.com/csdnv2

lcht1 2005-11-09
  • 打赏
  • 举报
回复
但是这判断之间有代码,RaiseEvent ExceptionOccurrs ,那IF之间的代码放到什么地方?望赐教
真相重于对错 2005-11-09
  • 打赏
  • 举报
回复

if (this.ExceptionOccurrs != null)
{
}
===> RaiseEvent ExceptionOccurrs .... 后面可以跟参数

真相重于对错 2005-11-09
  • 打赏
  • 举报
回复
vb 好像不用判断ExceptionOccurrs 是否为null,
直接用RaiseEvent ,

16,722

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧