Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleCall a subroutine by name in VB6
Keywordssubroutine, routine, VB6, CallByName
CategoriesSoftware Engineering, Tips and Tricks
 
Use the CallByName function (VB6 only).
 
Private Sub Command1_Click()
    CallSubroutine "SubA"
End Sub

Private Sub Command2_Click()
    CallSubroutine "SubB"
End Sub

Private Sub CallSubroutine(ByVal sub_name As String)
    CallByName Me, sub_name, VbMethod
End Sub

Public Sub SubA()
    MsgBox "This is SubA"
End Sub

Public Sub SubB()
    MsgBox "This is SubB"
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated