0

Hi can anyone help me on how i can achieve this?

I want to have a real time result on two textbox.

double a, b, c, result;

if (txtPriceMetre.Text == "")
            {
                txtPriceMetre.Text = "0";
            }
            else
            {
                a = Convert.ToDouble(txtPriceMetre.Text);
            }

            if (txtLength.Text == "")
            {
                txtLength.Text = "0";
            }
            else
            {
                b = Convert.ToDouble(txtLength.Text);
            }

            if (txtPriceCut.Text == "")
            {
                txtPriceCut.Text = "0";
            }
            else
            {
                c = Convert.ToDouble(txtPriceCut.Text);
            }

            result = Convert.ToDouble((a * b) + c);
            txtNetPrice.Text = Convert.ToString(c);


this is my code of my txtLength_Textchanged()

it's not working. can anyone help me?

2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

Only thing I see is, that since 'result','a','b', and 'c' are all doubles, Convert.todouble appears to be redundant. Other than that what's not working? Is it not updating when the text has changed in txtLength? If so how did you establish the event handler? The easiest way is to double click the textbox in the design window, and it will show the code window with the stub for the event handler started for you, and the event handler added to the textbox.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.