First chance exception at $772B4192. Exception class EConvertError with message ''$7FF7ED5B1000' is not a valid integer value'. Process Project2.exe (7412)
[Delphi] 纯文本查看复制代码
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Button2: TButton;
Button3: TButton;
Edit3: TEdit;
Edit4: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
function HexToOct(hValue: string): Integer;
begin
Result := StrToInt('$' + hValue);
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
Edit1.Text := IntToStr(HexToOct(Edit1.Text));
end;
procedure TForm2.Button3Click(Sender: TObject);
begin
// Edit1.Text := IntToStr(HexToOct(Edit1.Text)+ HexToOct(Edit3.Text)-HexToOct(Edit4.Text));
end;
end.