Is there an equivalent function in VB to eval() in javascript
I vaugley rememebr being able to use eval() to build expressions on the fly.
example:
for i = 0 to arSeg.length -1
for j = 1 to 4
if instr(arSeg(i),j)<>0 then
result = eval(seg&j) ' result should be the value of variable seg1 through seg4
end if
next j
next i

creating expressions dynamically?
Raj Chidipudi
Gisela
Found this:
Although I'm not sure I understand it yet.
'You can use the CallByName VB methode of the
'Microsoft.VisualBasic.Interaction class.
'Or you can create your own function
Public Function MyCallByName(ByVal O As Object, ByVal functionName As
String, ByVal Parameters() As Object) As Object
Try
Dim T As Type
Dim MI As MethodInfo
Dim ParamTypes(Parameters.Length - 1) As Type
Dim i As Integer
For i = 0 To Parameters.Length - 1
ParamTypes(i) = Parameters(i).GetType
Next i
T = O.GetType
MI = T.GetMethod(functionName, ParamTypes)
Return MI.Invoke(O, Parameters)
MI = Nothing
T = Nothing
Catch
Return Nothing
End Try
End Function
'The first parameter is the object or the module where the function is
'implemented.
'For exemple, you can use the functions like that :
Dim S As String
S = ""
S = S.Concat("Essai", " Toto")
Debug.WriteLine(S)
S = ""
S = CType(CallByName(S, "Concat", CallType.Method, New Object() {"Essai", "
Toto"}), String)
Debug.WriteLine(S)
S = ""
S = CType(MyCallByName(S, "Concat", New Object() {"Essai", " Toto"}),
String)
Debug.WriteLine(S)
we'll see how it pans out.
Todd
Grouchypb
Googhum