title: How to call a function in onclick event in xamarin.studio
body: <p>I am C# developer working on a simple calculator in xamarin.studio for android my code is</p>
  
  <pre><code>        btn9.Click += delegate {
              Buttonclick();
          };
          btnadd.Click += delegate {
              operationbuttonclick ();
          };
          btnsub.Click += delegate {
              operationbuttonclick ();
          };
          btndiv.Click += delegate {
              operationbuttonclick ();
          };
          btnmul.Click += delegate {
              operationbuttonclick ();
          };
          btneql.Click += delegate {
              txt1.Text=result.ToString();
              isfirst=true;
              hasdecimal=true;
              shouldclear=true;
          };
          btnCE.Click += delegate {
              txt1.Text="0";
              result=0;
              isfirst=true;
              shouldclear=true;
              hasdecimal=false;
          };
  </code></pre>
  
  <p>i am getting error in buttonclick(); and operationbuttonclick(); line 2 and 4 of above code. 
  my buttonclickmethod and operationbuttonclick methods are</p>
  
  <pre><code>private void Buttonclick(object sender,EventArgs e)
      {
          EditText txt2 = FindViewById&lt;EditText&gt; (Resource.Id.textView1);
          EditText txt1 = FindViewById&lt;EditText&gt; (Resource.Id.textView2);
          Button sbutton = (sender as Button);
          double oldno, newno,buttonno;
          if(shouldclear)
          {
              txt1.Text="";
              oldno=0;
              shouldclear=false;
          }
          else 
          {
              oldno=double.Parse(txt1.Text);
              hasdecimal = true;
          }
          buttonno=double.Parse(sbutton.Text);
          newno = (oldno * 10) + buttonno;
          if(isfirst)
          {
              num1=newno;
          }
          else
          {
              num2=newno;
          }
          txt1.Text += sbutton.Text;
          Calculate (symbol);
      }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>private void operationbuttonclick(object sender,EventArgs e)
      {
          EditText txt2 = FindViewById&lt;EditText&gt; (Resource.Id.textView1);
          EditText txt1 = FindViewById&lt;EditText&gt; (Resource.Id.textView2);
          num1 = result;
          Button sourcebutton=(sender as Button);
          string operatorsymbol = sourcebutton.Text;
          if (isfirst)
              isfirst = false;
          hasdecimal = true;
          symbol = operatorsymbol;
          txt1.Text = result.ToString ();
      }
  </code></pre>
  
  <p>In visual studio it can easily be done by going event handler of button and set the method in onclick event how to do it in xamarin. I've googled for this and can't find any appropriate solution. any help will be appreciated.</p>