Aman Jen

Aman Jen

  • NA
  • 141
  • 40.8k

Writing And Calling functions with in a form

Aug 27 2013 12:35 AM
Hi,
    I am switching from VB to C# and facing a Problem for writing and calling function with in a form.
below is my code:

two textboxes which accepts value to be added and result in third textbox on button click event.


  public int Add(int i, int j)
        {
            int result = i + j;
            return result;
            
        }
     
        protected void btnResult_Click(object sender, EventArgs e)
        {
            int result = Add(tb1.Text, tb2.Text);
            tb3.Text =(result);

        }


But showing error invalid argument...

Plz help...

Answers (2)