Search code examples
c#textbox

set the value in textbox appears automatically


I'm working on a project now, to make it easier to work I decided to make related textbox, the question is how to set the value of textbox so that it will be appears automatically?

Inthis case, Rnol = Pnol + Qnol + Nnol
I want Rnol value to be printed automatically in tbRnol/textbox Rnol when I click Button..

        Pnol = double.Parse(tbPnol.Text);
        Qnol = double.Parse(tbQnol.Text);
        Nnol = double.Parse(tbNnol.Text);
        Rnol = Pnol + Qnol + Nnol(tbRnol.Text); //I've try this but it clearly wrong syntax  

Solution

  • You could modify your last line to:

    Rnol = Pnol + Qnol + Nnol;
    

    And add this one:

    tbRnol.Text = Rnol.ToString();