troubleshooting Question Evaluate IF/Else logical expression

Avatar of stuart100
stuart100 asked on
ASP.NETVisual Basic.NET
4 Comments1 Solution597 ViewsLast Modified:

I am trying to evaluate an IF/Else expression (using .Net 2.0). The expression (sValidation) comes from the database, and will be used to validate the values entered into a form by the user. The following is a sample of sValidation:

If Form.Data.Field("Test Name").Value = "Testing one...two...three" Then
 Return True
 Return False
End If

I tried using MSScriptControl, but have been unsuccessful. Using the EVAL(sValidation) I get a syntax error. If I put sValidation within a function (sCode), addCode(sCode) and use the RUN(sCode) then I get a "Class doesn't support Automation: 'Form.Data.Field'" error.

Form, Data, and Field are classes I built, and I think that's where it's getting hung up. I tried to addObject for the class, and I also tried to add the class code to sCode, but still no avail. (If I pass the actual value of "Form.Data.Field("Test Name").Value" as a parameter in sCode, then the expression is evaluated correctly - hence why I think it's the class...but I could be wrong)

Has anyone else had success evaluating this type of expression using classes?

Any suggestions of solving this, either with MSScriptControl or another method would be fantastic.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros