Search code examples
pascalfreepascallazarustype-conversion

Lazarus error - how to store result of integer in textbox?


I'm trying out a very simple program in LAZARUS to multiply two text box values and store the result in a third one. This line is what I'm using.

txtA.Text = IntToStr( StrToInt(txtA.Text ) + StrToInt(txtB.Text) );

Unfortunately I get an error stating it's illegal.

Is this a fault on my part or a bug in Pascal?

Thanks for any tips!


Solution

  • The assigments in Pascal uses :=

    try this

    txtA.Text := IntToStr( StrToInt(txtA.Text ) + StrToInt(txtB.Text) );