Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在vb中从c#翻译代码(复杂上升事件)_C#_Vb.net - Fatal编程技术网

在vb中从c#翻译代码(复杂上升事件)

在vb中从c#翻译代码(复杂上升事件),c#,vb.net,C#,Vb.net,我有一段代码无法从c#翻译成vb: 我得到一个错误,它说: “公共事件ApplyChangeFailed(发件人作为对象,e作为Microsoft.Synchronization.Data.DbApplyChangeFailedEventArgs)”是一个事件,不能直接调用。使用“RaiseEvent”语句引发事件。 我甚至不知道该怎么办!对我来说太复杂了:( 有人能帮我吗?我不知道VB如何处理eventhandler,但从msdn文章判断: AddHandler DirectCast(sync

我有一段代码无法从c#翻译成vb:

我得到一个错误,它说:

“公共事件ApplyChangeFailed(发件人作为对象,e作为Microsoft.Synchronization.Data.DbApplyChangeFailedEventArgs)”是一个事件,不能直接调用。使用“RaiseEvent”语句引发事件。

我甚至不知道该怎么办!对我来说太复杂了:(


有人能帮我吗?

我不知道VB如何处理eventhandler,但从msdn文章判断:

AddHandler DirectCast(syncOrchestrator.LocalProvider, SqlSyncProvider).ApplyChangeFailed, AddressOf New EventHandler(Of DbApplyChangeFailedEventArgs)(AddressOf Program_ApplyChangeFailed)

C#代码正在为更改失败事件添加事件处理程序。VB等价物将是
AddHandler
。使用此代码,我得到以下错误:“AddressOf”操作数必须是方法的名称(不带括号)。
DirectCast(syncOrchestrator.LocalProvider, SqlSyncProvider).ApplyChangeFailed += New EventHandler(Of DbApplyChangeFailedEventArgs)(AddressOf Program_ApplyChangeFailed)
AddHandler DirectCast(syncOrchestrator.LocalProvider, SqlSyncProvider).ApplyChangeFailed, AddressOf New EventHandler(Of DbApplyChangeFailedEventArgs)(AddressOf Program_ApplyChangeFailed)