Let's say I have a page Test.aspx along with test.aspx.vb.
Test.aspx.vb contains a class name "TestClass". In that class I have method1(), method2() and method3()
I need to be able to call one of those methods, but I can't hard code it, the method to be executed comes from a string.
I can't do
Select Case StringContainingTheNameOfTheDesiredMethod
Case "Method1"
Method1()
Case "Method2"
Method2()
end case
.
That I could find how to do with reflection (I followed that example). My problem is that those methods might need to interact with test.aspx, but when I use .invoke it seems to create a new thread or context and any reference to test.aspx becomes null (setting label1.text = "something" will generate a null reference, but a direct call of method1 (without invoke) will update label1.text just fine.
Is there any solution ? Can anyone give me some tips?