{
Val example
}
uses Dialogs;
var 
  I, Code: Integer;
begin
  { Get text from TEdit control }
  Val(Edit1.Text, I, Code);
  { Error during conversion to integer? }
  if Code <> 0 then
    MessageDlg('Error at position: ' + IntToStr(Code), mtWarning, [mbOk], 0, mbOk);
  else
    Canvas.TextOut(10, 10, 'Value = ' + IntToStr(I));
end; 
