Calling A function from a recordset?

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I built this nice system, where in a part of the program, I can
actually look up what other functions/procedures I need to call.
Problem is I have no idea how do you call a function whos function
Name is inside a recordset..

in other words something like this
dim nextfunction as string
nextFunction=datareader("functname")
Call nextfunction <---- this is in essence what I want to do?
 
Try This

Public Class TestObj

Public Sub TestSub()
MsgBox("TestSub")
End Sub

Public Function TestFunction(ByVal text As String)
MsgBox(text)
End Function

End Class

Class TestCall

Sub Test
Dim x As New TestObj

x.GetType.GetMethod("TestSub").Invoke(x, Nothing)
x.GetType.GetMethod("TestFunction").Invoke(x, New Object() {"Hello
World"})
End Sub

End Class
 
Todd, I tried this and keep getting an System.NullReferenceException:
Object reference not set to an instance of an object.
error... any ideas?

by the way where you have x as new testobj I have mine set to the name
of my project.index which is the name of the class of my web form code
behind where the functions are.. could that be the problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top