Khoi

Khoi

  • NA
  • 18
  • 0

Sum problem

Nov 2 2009 11:39 AM
Below is my code in Win Form:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int bx1, bx2, sumbx = 0;
            bx1 = int.Parse(txt1.Text);
            bx2 = int.Parse(txt1.Text);
            sumbx = bx1 + bx2;
            txt3.Text = sumbx.ToString();


        }
    }

The problem is when 2 numbers are added, the result is always less than 1 compared to the actual result. For example: in bx1 I input 1, bx2 I input 2, the expected result must be 3, but it shows 2. Please advise

Thanks,
Ice

Answers (3)