Converting EditText into Int
<p>I am getting the user to input their height and weight into an <code>EditText</code> and then calculate their BMI. I am trying to convert the <code>EditText</code> into an <code>int</code> so I can do the calculation. </p>

<pre><code> EditText userHeight = FindViewById&lt;EditText&gt;(Resource.Id.editTextHeight);
 EditText userWeight = FindViewById&lt;EditText&gt;(Resource.Id.editTextWeight);


 int intuserweight = Convert.ToInt32(userWeight.Text);
 intuserweight = int.Parse(userWeight.Text);

 int intuserheight = Int32.Parse(userHeight.Text);
</code></pre>

<p>I have tried both conversions and both state <code>System.FormatException: Input string was not in a correct format</code>.</p>

<p>Edit Full code for Enter Intake Class:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace AndroidDoctorApp
 {
[Activity(Label = "Enter Intake")]
public class EnterIntake : Activity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        // Create your application here

        SetContentView(Resource.Layout.EnterIntake);



        EditText userDate = FindViewById&lt;EditText&gt;(Resource.Id.editTextDate);
        EditText userTime = FindViewById&lt;EditText&gt;(Resource.Id.editTextTime);
        EditText userHeight = FindViewById&lt;EditText&gt;(Resource.Id.editTextHeight);
        EditText userWeight = FindViewById&lt;EditText&gt;(Resource.Id.editTextWeight);

        Button btnBMI = FindViewById&lt;Button&gt;(Resource.Id.btnCalcBMI);
        Button btnAddHistory = FindViewById&lt;Button&gt;(Resource.Id.buttonAddHistory);
        Button btnViewHistory = FindViewById&lt;Button&gt;(Resource.Id.buttonViewHistory);




        int bmi;
        int intuserweight = int.Parse(userWeight.Text.ToString());
       // intuserweight = int.Parse(userWeight.Text);


        int intuserheight = Int32.Parse(userHeight.Text);

        bmi = intuserweight / (intuserheight * intuserheight);


        btnBMI.Click += (object sender, EventArgs e) =&gt;
        {

            string toast = string.Format("Your BMI is:  ", bmi);
            Toast.MakeText(this, toast, ToastLength.Long).Show();


        };



        btnAddHistory.Click += (object sender, EventArgs e) =&gt;
        {

            string toast = string.Format("BMI Added to History ");
            Toast.MakeText(this, toast, ToastLength.Long).Show();

        };


    }
}
</code></pre>

<p>}</p>