title: Xamarin button click not working
body: <p>I'm trying to make a Button Click like in Windows Forum however, I'm doing something wrong, because nothing is written to console, and the text of the button doesn't change. I have the button text changing for testing purposes.
  Also I am aware that my method for connecting to the SQL Database is insecure, however this application is strictly for personal use, and as-of right now learning purposes. Anyways, here's my code:</p>
  
  <p>Main.axml Code:</p>
  
  <pre><code>&lt;Button
  android:text="Login"
  android:layout_width="match_parent"
  android:layout_height="0dp"
  android:layout_weight="15"
  android:background="@drawable/buttonstyle"
  android:id="@+id/buttonLogIn"
  android:layout_marginLeft="40dp"
  android:layout_marginRight="40dp"
  android:drawableLeft="@drawable/lockicon"
  android:textStyle="bold"
  android:textColor="#FFFFFF" /&gt;
  </code></pre>
  
  <p>MainActivity.cs Code:</p>
  
  <pre><code>using System;
  using Android.App;
  using Android.Widget;
  using Android.OS;
  using CryptSharp;
  using MySql.Data.MySqlClient;
  using System.Data;
  
  namespace App1
  {
      [Activity(Label = "TexByte", MainLauncher = true, Theme = "@android:style/Theme.Black.NoTitleBar.Fullscreen", Icon = "@drawable/Logo_Mob2")]
      public class MainActivity : Activity
      {
          private EditText mtxtUsername, mtxtPassword;
          private Button mBtnSignIn;
  
          protected override void OnCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
  
              SetContentView(Resource.Layout.Main);
              mBtnSignIn = FindViewById&lt;Button&gt;(Resource.Id.buttonLogIn);
              mtxtUsername = FindViewById&lt;EditText&gt;(Resource.Id.txtUsername);
              mtxtPassword = FindViewById&lt;EditText&gt;(Resource.Id.txtPassword);
          }
          private void mBtnSignIn_Click(object sender, EventArgs args)
          {
              MySqlConnection con = new MySqlConnection("Server=127.0.0.1;User Id=root;Password=password;Database=login;");
              try
              {
                  string username = mtxtUsername.Text;
                  string password = mtxtPassword.Text;
  
                  if (con.State == ConnectionState.Closed)
                  {
                      con.Open();
                      MySqlCommand cmd = new MySqlCommand("SELECT * FROM members WHERE username = '" + username + "' order by password ");
                      cmd.CommandType = CommandType.Text;
                      MySqlDataReader rdr = cmd.ExecuteReader();
  
                      while (rdr.Read())
                      {
  
                          string hash = string.Format("{0}", rdr["password"]);
                          Console.WriteLine(hash);
  
                          if (Crypter.CheckPassword(password, hash))
                          {
                              Console.WriteLine("User name and Password Success ");
                              mBtnSignIn.Text = "Test";
                          }
                          else
                          {
                              Console.WriteLine("Unable to process request. Verify username and password are correct.");
                              mBtnSignIn.Text = "Fail";
                          }
                      }
                  }
              }
              catch(MySqlException ex)
              {
                  Console.WriteLine("ERROR: Something went wrong. :( ", ex.Message);
              }
              finally
              {
                  con.Close();
              }
          }
      }
  }
  </code></pre>