Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Defined Delegate As Function , How To Convert It In VB.NET
    primarykey
    data
    text
    <p>I have this class , define delegate as function as fellow </p> <pre><code>&lt;br /&gt; using System;&lt;br /&gt; using System.Collections.Generic;&lt;br /&gt; using System.Linq;&lt;br /&gt; using System.Text;&lt;br /&gt; using System.ComponentModel;&lt;br /&gt; using System.Collections;&lt;br /&gt;&lt;br /&gt; namespace ClassLibrary1&lt;br /&gt; {&lt;br /&gt; public delegate bool DrillDownHandler(IComponent control);&lt;br /&gt; public delegate void ComponentLoadedHandler(IComponent control); public interface interface1 { event DrillDownHandler DrillDown; event ComponentLoadedHandler ComponentLoaded; } public class Class1 : interface1 { public Class1() { DrillDown += new DrillDownHandler(DrillDownDefault); } private ArrayList drillList = new ArrayList(); public event DrillDownHandler DrillDown { add { drillList.Add(value); } remove { drillList.Remove(value); } } public event ComponentLoadedHandler ComponentLoaded; private bool DrillDownDefault(IComponent control) { return false; } } } </code></pre> <hr> <p>When convert to VB.Net the following code we get ,,, but not work </p> <pre><code>&lt;br /&gt;&lt;br /&gt; Imports System&lt;br /&gt; Imports System.Collections.Generic&lt;br /&gt; Imports System.Linq&lt;br /&gt; Imports System.Text&lt;br /&gt; Imports System.ComponentModel&lt;br /&gt; Imports System.Collections&lt;br /&gt; &lt;br /&gt; Namespace ClassLibrary1&lt;br /&gt; Public Delegate Function DrillDownHandler(control As IComponent) As Boolean&lt;br /&gt; Public Delegate Sub ComponentLoadedHandler(control As IComponent)&lt;br /&gt; Public Interface interface1 Event DrillDown As DrillDownHandler Event ComponentLoaded As ComponentLoadedHandler End Interface Public Class Class1 Inherits interface1 Public Sub New() DrillDown += New DrillDownHandler(DrillDownDefault) End Sub Private drillList As New ArrayList() Public Custom Event DrillDown As DrillDownHandler AddHandler(ByVal value As DrillDownHandler) drillList.Add(value) End AddHandler RemoveHandler(ByVal value As DrillDownHandler) drillList.Remove(value) End RemoveHandler End Event Public Event ComponentLoaded As ComponentLoadedHandler Private Function DrillDownDefault(control As IComponent) As Boolean Return False End Function End Class End Namespace </code></pre> <p>Any one can help </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload