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.新人,分少!
//IF copy(Memo1.lines.Strings[1],1,4)='000' then
User.Caption:='正确的!'
Else
User.Caption:='错误的!';USER是一个FORM.新人,分少!
解决方案 »
- DELPHI RXRICHEDIT插入GIF后闪烁
- 谁有Rxlib2.75 for delphi5吗?
- fastreport在使用自定义纸张大小的时候,为什么不管是打开设计界面或是使用的时候速度都很慢????
- 一个超级简单的问题等待解答一下
- TdbEdit连接的是一个时间类型的字段,当输入的字符不合法时,程序就会瘫痪
- 如何让自己编写的控件实现右键菜单功能?
- 多线程更新cxgrid的时候,表格闪烁的利害阿
- 关于全排列的问题?
- 在用Paradox数据库时,如何生成 .MB文件?
- 如何做?请高手给一个思想
- ADOQuery如何取得记录位置
- 连锁系统中分部向总部传输数据,大家是怎么来保证主键不重复的?
//IF copy(Memo1.lines.Strings[1],1,4)='000' then
User.Caption:='正确的!'
Else
User.Caption:='错误的!';
你copy过来的是两个字符,却拿去跟'000'三个字符比较,当然出错。
2改为3,或者'000'改为'00'
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.
试过的.谢谢.
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'
2、Incompatible types不兼容的数据类型。 IF Copy(Edit1.Text,1,2)='000' then 这一行不可能会报出这样的错,你的'000'是不是另有代替的
直接等于一个label了,你要等于label.caption
不行!
稿掂了.我犯的低级错误!哈! 原来我把一个label的名字改成copy了,所以,COPY函数用不了!结贴去!