Куда столько begin-ов?
| Код |
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Label1: TLabel; Button1: TButton; Label2: TLabel; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; p : integer ; ProvPass : real ;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin p := 123456789; ProvPass := StrToFloat(Edit1.Text); if ProvPass =p then Label2.Caption := 'This software is Registred to...!' else Label2.Caption := 'Invalid Passwod'; end;
end.
|
Твой исправленный будет выглядеть так:
| Код |
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Label1: TLabel; Button1: TButton; Label2: TLabel; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; p : integer ; ProvPass : real ; implementation {$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin p := 123456789; ProvPass := StrToFloat(Edit1.Text); begin if ProvPass =p then begin Label2.Caption := 'This software is Registred to...!' ; end; end; begin if ProvPass <> p then begin Label2.Caption := 'Invalid Passwod'; end; end; end;
end.
|
1) В твоем коде не хватает ендов и 2) ";" после then не ставится.
В оба кода необходимо добавить ветвление на случай, если поле будет пустое. |