How to initialise a delegate member in a structure.

OzMaz

New member
Joined
Jul 28, 2022
Messages
1
Location
Australia
Hi folks,

Just trying to tidy up my code and have an issues assigning members to a structure that contains a Delegate.

I tried this initially and it works, but, it's long and tedious.

Public Delegate Sub NAH()

Structure sDirective
Public DirectiveName As String
Public DirectiveFunction As NAH
End Structure

Dim DirectiveList(10) As sDirective

then ...

With DirectiveList(0)
.DirectiveName = "END"
.DirectiveFunction = New NAH(AddressOf DirectiveEND)
End With

This works.

I have 15 elements.

I would like to do something like this

Dim DirectiveList() as sDirective = {{"END", New NAH(Addressof DIRECTIVEEND}, etc}

Any ideas?

Thanks.
 
Last edited:
Back
Top