C# button not returning expected value
<p>I have a windows ATM app and I'm stuck on this part:</p>

<p>I have <code>pin</code> and <code>firstName</code> as private strings and balance as private double.
<br>However, when I try to display the balance in the text area, it just prints <code>0</code>. Is it because <code>retrieveAccountInformation()</code> has void as the return? How can I change my code so that I can use <code>pin</code>, <code>firstName</code>, and <code>balance</code> in my other methods? </p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SQLDll;

namespace WindowsFormsApplication14
{

public partial class Form1 : Form
{
    private Connection myConnection;
    private Statement myStatement;
    private ResultSet myResultSet;

    String databaseURL = "http://www.boehnecamp.com/phpMyAdmin/razorsql_mysql_bridge.php";
    public string pin, firstName, userAccountNumber;
    public double balance;
    public double withdraw = 0;
    public double deposit = 0;
    bool buttonClicked;
    bool buttonClicked2;

    public Form1()
    {
        InitializeComponent();

        try
        {
            //connect to database
            SQL sql = new SQL();
            myConnection = sql.getConnection(databaseURL);
            //create Statement for executing SQL
            myStatement = myConnection.createStatement(databaseURL);
            loadAccountNumbers();
            updateBalance();
        }
        catch (Exception)
        {
            Console.WriteLine("Cannot connect to database server");
        }
        //close statement and database connection 
       myStatement.close();
       myConnection.close();
    }
    private void Form1_Load(object sender, EventArgs e)
    {

    }

    public void setText(string text)
    {


    }
    //load account numbers to ComboBox
    private void loadAccountNumbers()
    {
        //get all account numbers from database
        try
        {
            myResultSet = myStatement.executeQuery("SELECT accountNumber FROM accountInformation");
            // add account numbers to ComboBox
            while (myResultSet.next())
            {
                accountNumberComboBox.Items.Add(myResultSet.getString("accountNumber"));
            }
            myResultSet.close(); // close myResultSet
        }//end try
        catch (Exception)
        {
            Console.WriteLine("Error in loadAccountNumbers");
        }
    }//end method to loadAccountNumbers

    private void retrieveAccountInformation()
    {
        //get account info
        try
        {
            myResultSet = myStatement.executeQuery("SELECT pin, " +
           "firstName, balanceAmount FROM accountInformation " +
           "WHERE accountNumber = '" + userAccountNumber + "'");

            //get next result
            if (myResultSet.next())
            {
                pin = myResultSet.getString("pin");
                firstName = myResultSet.getString("firstName");
                balance = myResultSet.getDouble("balanceAmount");
            }
            myResultSet.close(); //close myResultSet
        }//end try
        catch (Exception)
        {
            Console.WriteLine("Error in retrieveAccountInformation");
        }
    }// end method retrieveAccountInformation

    //update database after withdrawing
    private void updateBalance()
    {
        //update balance in database
        try
        {
            myStatement.executeUpdate("UPDATE accountInformation" +
                           " SET balanceAmount = " + balance + " WHERE " +
                           "accountNumber = '" + userAccountNumber + "'");

        }
        catch (Exception)
        {
            Console.WriteLine("Error in updateBalace");
        }
    }//end method updateBalance

    private void accountNumberComboBox_SelectedIndexChanged(object sender, EventArgs e)
    {
        accountNumberComboBox.Enabled = false;
        numberTextField.Text = " ";
        messageTextArea.Text = "Enter your PIN #.";
        button0.Enabled = true;
        button1.Enabled = true;
        button2.Enabled = true;
        button3.Enabled = true;
        button4.Enabled = true;
        button5.Enabled = true;
        button6.Enabled = true;
        button7.Enabled = true;
        button8.Enabled = true;
        button9.Enabled = true;
        buttonDone.Enabled = true;
        retrieveAccountInformation();

    }

    private void button1_Click(object sender, EventArgs e)
    {
        setText("1");
        numberTextField.Text += "1";
        buttonEnter.Enabled = true;

    }


    private void button2_Click(object sender, EventArgs e)
    {
        setText("2");
        numberTextField.Text += "2";
        buttonEnter.Enabled = true;

    }

    private void button3_Click(object sender, EventArgs e)
    {
        setText("3");
        numberTextField.Text += "3";
        buttonEnter.Enabled = true;

    }

    private void button4_Click(object sender, EventArgs e)
    {
        setText("4");
        numberTextField.Text += "4";
        buttonEnter.Enabled = true;

    }

    private void button5_Click(object sender, EventArgs e)
    {
        setText("5");
        numberTextField.Text += "5";
        buttonEnter.Enabled = true;

    }

    private void button6_Click(object sender, EventArgs e)
    {
        setText("6");
        numberTextField.Text += "6";
        buttonEnter.Enabled = true;

    }

    private void button7_Click(object sender, EventArgs e)
    {
        setText("7");
        numberTextField.Text += "7";
        buttonEnter.Enabled = true;

    }

    private void button8_Click(object sender, EventArgs e)
    {
        setText("8");
        numberTextField.Text += "8";
        buttonEnter.Enabled = true;

    }

    private void button9_Click(object sender, EventArgs e)
    {
        setText("9");
        numberTextField.Text += "9";
        buttonEnter.Enabled = true;

    }

    private void button0_Click(object sender, EventArgs e)
    {
        setText("0");
        numberTextField.Text += "0";
        buttonEnter.Enabled = true;

    }

    private void buttonEnter_Click(object sender, EventArgs e)
    {
            numberTextField.Text = " ";
            buttonEnter.Enabled = false;
            button1.Enabled = false;
            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;
            button5.Enabled = false;
            button6.Enabled = false;
            button7.Enabled = false;
            button8.Enabled = false;
            button9.Enabled = false;
            button0.Enabled = false;
            buttonBalance.Enabled = true;
            buttonWithdraw.Enabled = true;
            buttonDeposit.Enabled = true;
            messageTextArea.Text = "Welcome," + firstName;
            updateBalance();
           if (buttonClicked == true)
            {
                withdraw = Double.Parse(numberTextField.Text);
                balance = balance - withdraw;
                updateBalance();
            }

    }

    private void buttonBalance_Click(object sender, EventArgs e)
    {
        retrieveAccountInformation();
        updateBalance();

        messageTextArea.Text=(balance.ToString());
        //display balance to messageTextArea
    }

    private void buttonWithdraw_Click(object sender, EventArgs e)
    {
        buttonBalance.Enabled = false;
        buttonWithdraw.Enabled = false;
        button0.Enabled = true;
        button1.Enabled = true;
        button2.Enabled = true;
        button3.Enabled = true;
        button4.Enabled = true;
        button5.Enabled = true;
        button6.Enabled = true;
        button7.Enabled = true;
        button8.Enabled = true;
        button9.Enabled = true;
        messageTextArea.Text = "Enter withdrawal amount:";
        buttonClicked = true;

    }

    private void buttonDone_Click(object sender, EventArgs e)
    {
        button1.Enabled = false;
        button2.Enabled = false;
        button3.Enabled = false;
        button4.Enabled = false;
        button5.Enabled = false;
        button6.Enabled = false;
        button7.Enabled = false;
        button8.Enabled = false;
        button9.Enabled = false;
        button0.Enabled = false;
        buttonEnter.Enabled = false;
        buttonBalance.Enabled = false;
        buttonWithdraw.Enabled = false;
        buttonDone.Enabled = false;
        buttonDeposit.Enabled = false;
        accountNumberComboBox.Enabled = true;
        messageTextArea.Text = "Please select your account number.";


    }

    private void buttonDeposit_Click(object sender, EventArgs e)
    {
        buttonBalance.Enabled = false;
        buttonWithdraw.Enabled = false;
        button0.Enabled = true;
        button1.Enabled = true;
        button2.Enabled = true;
        button3.Enabled = true;
        button4.Enabled = true;
        button5.Enabled = true;
        button6.Enabled = true;
        button7.Enabled = true;
        button8.Enabled = true;
        button9.Enabled = true;
        messageTextArea.Text = "Enter deposit amount:";
        buttonClicked2 = true;

    }
}
</code></pre>

<p>}</p>
