VB Equivalent to C # event creation

I am trying to extend the GridView class to always show the header and footer, even when the data source is empty using the code I found online ( link ). However, the code is written in C #, but I use VB.

What is the next VB equivalent?

public event MustAddARowHandler MustAddARow;

Is there a way that VB.NET does not allow events to return a type?

Also, I cannot convert the following function due to the error below.

Code:

Protected Function OnMustAddARow(ByVal data As IEnumerable) As IEnumerable
    If MustAddARow = Nothing Then 'Error on MustAddARow'
        Throw New NullReferenceException("The datasource has no rows.  You " _
                                        & "must handle the 'MustAddARow' Event.")
    End If
    Return MustAddARow(data) 'Error on MustAddARow'
End Function

Error: Public event MustAddARow (data As System.Collections.IEnumerable) 'is an event and cannot be directly called. Use the expression "RaiseEvent" to raise an event.

+2
3

(), # DLL, VB-.

0

:

Public Event MustAddRow(data As IEnumerable)
+2

: . . ( ), , , , VB.NET.


:

Public Event MustAddRow As MustAddRowHandler

: ( )

Public Delegate Function MustAddRowHandler(ByVal data As IEnumerable) As IEnumerable
+2

Source: https://habr.com/ru/post/1705599/


All Articles