write any equations like this "(x^2+x)/(x*x)"
in text box 1
and write the value "x" in text box 2 , he has the value of this equation in message box when he press ok.
please, help me to get this code
and thank u .
and my problem , How can i write power expression in this code:
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(Evaluate(textBox1.Text.Replace("x",textBox2.Text)).ToString());
}
public static double Evaluate(string expression)
{
return (double)new System.Xml.XPath.XPathDocument
(new StringReader("
(string.Format("number({0})", new
System.Text.RegularExpressions.Regex(@"([\+\-])")
.Replace(expression, " ${1} ")
.Replace("/", " div ")
Munir ShaikhPosted Sep 27, 2007, 3:26 AM
My suggestion is increase number of textboxes and add a drop-down for the signs such as ^, /,*,+,- etc and only accept variables like x in the textbox and then on button click do your work this way it will be more easy to you, else you have to do much coding at the server side
Regards,
>>Munnamax