I wanted to read input equation by user A+B and assign input user value to A and B to ask them to add and give answer. But I just can't get the code to work. I using VS2005 and VB.Net. Can help me with my code:

Dim A As Double
        Dim B As Double

        '// Use the String.Split method to seperate the part before the + and after.
        Dim equation As String() = textbox3.Text.Split(CChar("+"))

        '// Equation will now contain 2 elements. Convert them both to doubles and put the first element in A and the 2nd (last) in B.
        A = Convert.ToDouble(equation(0))
        B = Convert.ToDouble(equation(1))

        MsgBox("Answer = " & A + B)

It may be easier to just assign diferent textboxes to the A and B sorta:

A= Cdbl(texbox1.text) 
B= Cdbl(textbox2.text)

then you can add them. This is a simpler solution. of course you can always have buttons that assign the operator.

Hope this helps. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.