IF Copy(Edit1.Text,1,2)='000' then  //此行报错!!!
   //IF copy(Memo1.lines.Strings[1],1,4)='000' then
   User.Caption:='正确的!'
   Else
   User.Caption:='错误的!';USER是一个FORM.新人,分少!

解决方案 »

  1.   

      IF Copy(Edit1.Text,1,2)='000' then  //此行报错!!! 
      //IF copy(Memo1.lines.Strings[1],1,4)='000' then 
      User.Caption:='正确的!' 
      Else 
      User.Caption:='错误的!'; 
    你copy过来的是两个字符,却拿去跟'000'三个字符比较,当然出错。
    2改为3,或者'000'改为'00'
      

  2.   

    unit c;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, ComCtrls;type
      TReg = class(TForm)
        CPUID: TLabel;
        OSID: TLabel;
        NameID: TLabel;
        CPU: TLabel;
        OS: TLabel;
        Name: TLabel;
        Image1: TImage;
        line1: TPanel;
        line2: TPanel;
        Copy: TLabel;
        Memo1: TMemo;
        Label1: TLabel;
        Label2: TLabel;
        Label4: TLabel;
        Label3: TLabel;
        Button1: TButton;
        User: TLabel;
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Reg: TReg;implementationuses a, b;{$R *.dfm}function GetComputerName: AnsiString;
    var lpBuffer: array[0..MAX_PATH] of char;
        dwSize: DWORD;
    begin
      dwSize:= MAX_PATH;
      if not Windows.GetComputerName(lpBuffer, dwSize) then
        raise Exception.Create(SysErrorMessage(GetLastError()));
      Result:= StrPas(lpBuffer);
    end;procedure TReg.FormShow(Sender: TObject);
    var
       _eax, _ebx, _ecx, _edx: Longword;
       s, s1, s2,result: string;
       GETVER:OSVERSIONINFO; //声明所需变量,具体内容请参考API函数说明文件。
       RET:LONGBOOL;
       //i:integer;
    begin
        asm
         push eax
         push ebx
         push ecx
         push edx
         mov eax,1
         db $0F,$A2
         mov _eax,eax
         mov _ebx,ebx
         mov _ecx,ecx
         mov _edx,edx
         pop edx
         pop ecx
         pop ebx
         pop eax
        end;
       s := IntToHex(_eax, 8);
       s1 := IntToHex(_edx, 8);
       s2 := IntToHex(_ecx, 8);
       result:=s+s1+s2;   GETVER.dwOSVersionInfoSize:=148;
       RET:=GETVERSIONEX(GETVER);
       CPUID.Caption:=result;
       NameID.Caption:=GetComputerName;
       IF GETVER.dwPlatformId=1 THEN
       OSID.Caption:='Windows95/98'+'  Build:'+IntToStr(Getver.dwBuildNumber);
       IF GETVER.dwPlatformId=2 THEN
       OSID.Caption:='Windows NT/2000/XP'+'  Build:'+IntToStr(Getver.dwBuildNumber);
       Image1.Picture.LoadFromFile(Extractfilepath(Application.exename)+'\info.jpg');
       //For i:=0 to  memo1.lines.Count-1 do
       //begin
       //showmessage()
       IF copy(Memo1.lines.Strings[1],1,3)='000' then   //此行报错.
       //M2:=copy(memo1.lines[0],5,length(memo1.lines[0])-5);
       User.Caption:='OK!'
       Else
       User.Caption:='NG!';
       //End;
    end;end.
      

  3.   


    试过的.谢谢.
    Build
      [Error] c.pas(95): Missing operator or semicolon
      [Error] c.pas(95): Incompatible types: 'String' and 'TLabel'
      [Fatal Error] Readdata.dpr(7): Could not compile used unit 'c.pas'
      

  4.   

    1、 Missing operator or semicolon 少了符号或者少了类似于end的关键字,自己查看代码哪里少东西了
    2、Incompatible types不兼容的数据类型。  IF Copy(Edit1.Text,1,2)='000' then  这一行不可能会报出这样的错,你的'000'是不是另有代替的
    直接等于一个label了,你要等于label.caption
      

  5.   

    ............等于label.caption也试了....
    不行!
    稿掂了.我犯的低级错误!哈!   原来我把一个label的名字改成copy了,所以,COPY函数用不了!结贴去!