Link to home
Create AccountLog in
Avatar of foszor

asked on

Store functions in custom types for callback later

Hypotheticly speaking, i would like to do this:

Private Type MyCustomType
   name as string
   callback as function   <--- here is my question, how to store this
End Type

Private MyFunctions(10) as MyCustomType

Private Sub DoConnect()
End Sub

Private Sub Main()
   MyFunctions(0).name = "connect"
   MyFunctions(0).callback = DoConnect

   FindFunction "connect"
End Sub

Public Sub FindFunction(sName as String)
   Dim iCounter as Integer

   For iCounter = 0 to UBound(MyFunctions)
      If sName = MyFunctions(iCounter).name then
      End If
   Next iCounter
End Sub

Now this isnt exactly what i want to do but i hope it gets the point across, Any help would be greatly appriciated
Avatar of Ralf Klatt
Ralf Klatt
Flag of Germany image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account