I have made a GUI calculator. So when someone presses a button the numbers and symbols are displayed in a label then when they press enter the computer captures the string and that is where i need some help. I know that in Python there is a eval statement that can be used is there something similar in C#.
Here is the code if that helps. specifically look at the method button_click
public class form1 : Form
{
private Label lab;
private Button button2;
private Button button;
private Button plus;
private MathFunctions.MathParser calc;
public static void Main()
{
Application.Run(new form1());
}
public form1()
{
// Initialize controls
...
}
private void button_Click(object sender,System.EventArgs e)
{
string answer = lab.Text;
}
private void button2_Click(object sender,System.EventArgs e)
{
lab.Text = lab.Text + "2";
}
private void button_plus(object sender,System.EventArgs e)
{
lab.Text = lab.Text + "+";
}
}