[Solved] Trouble calling variables [closed]


The sample you provided have some mistakes. addValues method in your code is not accepting any parameters but your code is trying to pass 2 parameters. I have re wrote your code. Please see below code snippet meets your requirement

 private int addValues(int var1, int var2)
 {
     return var1 + var2;
 }

 private void plus_Click(object sender, RoutedEventArgs e)
 {
    int result = addValues(int.Parse(box1.Text), int.Parse(box2.Text));
    res.Text = (result.ToString());
 }

2

solved Trouble calling variables [closed]