views:

67

answers:

3

I actually have an equation to make on visual basic.

An exemple of it

(12 = 12) AND (12>1)
   true   and   true

the answer would be TRUE

But for both comparison operators i must create a combo box to insert <, >, =, <=, >=, <>

My problem is my program wont function because I don't know which variable to use for those... could anyone answer me ?...

A: 

The answer is that you should create a SELECT CASE statement where you evaluate every possible combobox combination and build your formula based on that.

AngryHacker
Wow, hope you're right about what's being asked for. :-)
RBarryYoung
A: 

You can try to Evaluate your VB expression at runtime, the suggested link shows you how. For a more.. .NET solution, check this article: it shows you how to take advantage from the Compute method within a DataTable to evaluate simple expressions. It also lists an MSDN link to all available operations.

HTH, mt

m.bagattini
A: 

I think you could do it using string types...

if string.format("{0}{1}{2}",cbox1.text,cbox2.text,cbox3.text)=true then

end if...

I dont have a compiler on my home computer but I think that would work for you. I do something similar with radio buttons, but its a full string comparison...

ecathell