Hi everyone:

I was wondering if anyone knew how to define and call pointers to functions/subs in VB like we used to do in C? I tried to use the AddressOf opperator, but I can't seem to get it to work. I attempted a simple test: When a command button is clicked, it calls a function by pointer...

I tried various arangements, but the closest I came was -

[In a form (with 1 text box and one command button...) -]
Private Sub Command1_Click()
Dim FnPtr As Long

FnPtr = GetFnPtr(AddressOf testfunction)
Call FnPtr '<-Didn't work; gave error
End Sub

[In a module -]
'Function wrapper?
Public Sub testfunction(testval As Integer)
Form1.Text1.Text = "DID IT!"
End Sub

'Assign address
Public Function GetFnPtr(ByVal ptr As Long) As Long
GetFnPtr = ptr
End Function

Any ideas?