Connecting Tech Pros Worldwide Forums | Help | Site Map

Call a Subroutine

Newbie
 
Join Date: Feb 2008
Posts: 27
#1: Apr 17 '08
I'm working in Visual Basic .NET 2005

I'm creating a program that could potentially hold 50 or more subroutines. However, I will only be calling three or four of the subroutines at a time. I would like to be able to hold the names of the subroutines I want to call inside of an array. However I don't know how to convert the string name into a form that I can call the subroutine with. This is the code that I'm trying to make work

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub Load(ByVal Tables() As String, ByVal name As String, ByVal password As String)
  3.  
  4.         Dim Table As String
  5.         For Each Table In Tables
  6.             Table(name, password) 'This is where I want to call the subroutine
  7.         Next
  8.     End Sub
  9.  
  10.  

P.S. I can accomplish what I want by creating a long Select Case and I will probably stick with it, but I would still like to know how to call a subroutine using a string for the name

Reply