Results 1 to 3 of 3

Thread: Pass a function pointer into a VB Sub? (C-ish)

  1. #1

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Pass a function pointer into a VB Sub? (C-ish)

    Hi all,

    is it possible to pass a function pointer to a VB Sub/Function?

    Thanks!

    Dave

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    VB Code:
    1. Private Sub Command1_Click()
    2.     Call CallOthers(UCase(Text1.Text))       'convert text1.text to upper case, and pass this letter to CallOthers function
    3. End Sub
    4.  
    5. Sub A()
    6.     MsgBox "A"
    7. End Sub
    8.  
    9. Sub B()
    10.     MsgBox "B"
    11. End Sub
    12.  
    13. Sub C()
    14.     MsgBox "C"
    15. End Sub
    16.  
    17. Sub D()
    18.     MsgBox "D"
    19. End Sub
    20.  
    21. Sub E()
    22.     MsgBox "E"
    23. End Sub
    24.  
    25. Sub CallOthers(Func As String)
    26.     CallByName Form1, Func, VbMethod                  'Call the sub whoose name was given in Func argument.
    27. End Sub

  3. #3

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    Cool Thx!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width