我有这个算法,我想在VB6上实现。如何调用函数名称引用一个字符串值在VB中
Sub Main()
dim stringVal1 as string, stringVal2 as string
dim getOne as boolean
stringVal1 = "FunctOne"
stringVal2 = "FunctTwo"
if getOne then
'Call Function with function name assigned to stringVal1 ... how to call the function here?**
else
'Call Function with function name assigned to stringVal1 ... how to call the function here?**
end if
End Sub
Function FunctOne()
Msgbox "I'm function one"
End Function
Function FunctTwo()
Msgbox "I'm function two"
End Function
这可以在VB6中完成吗?
AFAIK是做多态性VB6 – Andrey 2010-04-13 13:25:23
@Andrey的唯一途径:不,你很错误:VB6知道接口(http ://stackoverflow.com/questions/2581087)。此外,VB6支持后期绑定,因此您可以调用多态对象上的方法(但这不再适用于Option Explicit)。 – 2010-04-13 13:27:45
我是错的。仍然我讨厌VB6 :) – Andrey 2010-04-13 13:30:30