IntToStr (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses two edit controls, a button, and a label on a form. When the button is clicked, the integers in the edit controls are multiplied together and the result is displayed in the label.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  try
  {
    Label1->Caption = IntToStr(StrToInt(Edit1->Text) * StrToInt(Edit2->Text));
  }
  catch(...)
  {
    ShowMessage("You must specify integer values. Please try again.");
  }
}

Uses