tags:

views:

45

answers:

1

I am creating an application which has 3 text boxes, the user inputs two integer values and then 3rd text box is a readonly box and is meant to contain the sum of the two input values. all these input values are then supposed to be adding to their corresponding fields int he database table. Can some one help show me the code that can implement this?

A: 

As Marc said, your question is very vague, maybe you need something like:

        int a, b, c;
        if (int.TryParse(textBox1.Text, out a) && int.TryParse(textBox2.Text, out b))
        {
            c = a + b;
            textBox3.Text = c.ToString();
            myNumberRepository.Add(c); //Assuming you already have a way to write to the DB;
        }

Assuming your accessing the UI elements directly by name. If your binding to values in the code behind or a viewmodel replace textBoxX.Text with those values.

jdoig