Link to home
Create AccountLog in
Avatar of foszor
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()
   Winsock1.Connect
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
         MyFunctions(0).callback
      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
ASKER CERTIFIED SOLUTION
Avatar of Ralf Klatt
Ralf Klatt
Flag of Germany image

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