I am trying to get the selected card number that has logged in via entering their pin number from an sql database which I then need to match that selected card number to retrieve their balance from the database and display it into a rich text box. I have been able to take the PIN from the database and match it with the users cardnumber to give them access to form 2 but i am finding it difficult to take the selected card number from the combo box on form1 and use it to retrieve the selected users balance once i click on the balance button and display it on form2 richtextbox. I have the following code:

```
public partial class Form1 : Form
{

    public int logAttempts = 3;
    public string accountNo;      

    public Form1()
    {
        InitializeComponent();            

    }

    private void btnCancel_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }

    private void BtnEnter_Click(object sender, EventArgs e)
    {
        int index = cBCardNumber.SelectedIndex;

        DataRow dpin = dataSet1ATMCards.Tables["ATMCards"].Rows[index];
        String pin = dpin.ItemArray.GetValue(1).ToString();           

        if (textBoxPin.Text.Length == 4)
        {
            if (String.Equals(pin, textBoxPin.Text))
            {
                Form2 frm2;
                frm2 = new Form2();
                frm2.ShowDialog();
            }
            else
            {
                if (loginAttempts == 1)
                {

                    sqlCommandConfiscated.Parameters["@cardNumber"].Value = cBCardNumber.Text;
                    sqlCommandConfiscated.Parameters["@confiscated"].Value = true;

                    try
                    {
                        sqlCommandConfiscated.Connection.Open();
                        sqlCommandConfiscated.ExecuteNonQuery();
                        MessageBox.Show("You have reached your maximum login attempts.");
                        textBoxPin.Clear();

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        sqlCommandConfiscated.Connection.Close();
                    }
                }
                else
                {
                    loginAttempts--;
                    MessageBox.Show("You have entered the Wrong Pin. You have " + loginAttempts);
                }
            }
        }
        else
        {
            MessageBox.Show("Please enter your 4 digit Pin Number");
        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {           
        sqlDataAdapter1.Fill(dataSet1ATMCards.ATMCards);       

    }

    private void cBCardNumber_SelectedIndexChanged(object sender, EventArgs e)
    {
        loginAttempts = 3;
    }   

    }
}

```