运行时出错,提示出错:
[Error] Unit1.pas(32): Ordinal type required
[Error] Unit1.pas(32): Incompatible types: 'Integer' and 'String'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
原码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Math;
type
TForm1 = class(TForm)
Edit1: TEdit;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Randomize;
Edit1.Text := RandomRange(['a1', 'a2', 'a3', 'a4']);
end;
end.
不知是什么原因,请高手们指点!