delphi中怎么把edit1.text的值赋给string类型变量?
sUser=edit1.Text提示错误,sUser是string类型的源代码如下:varForm1:TForm1;implementationusesinifiles,...
sUser=edit1.Text
提示错误,sUser是string类型的
源代码如下:
var
Form1: TForm1;
implementation
uses inifiles, Unit2;
var sUser,sPwd,u,p:string;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Conini:TiniFile;
begin
Conini:=TiniFile.Create('c:\my.ini');
//写
Conini.WriteString('Parameters','user','cai');
Conini.WriteString('Parameters','password','my');
//读
Conini.WriteString('Parameters','user','cai');
Conini.WriteString('Parameters','password','my');
sUser:=Conini.ReadString('Parameters','user','');
sPwd:=Conini.ReadString('Parameters','password','');
Conini.Free;
u:=sUser;
p:=sPwd;
end;
procedure TForm1.exitClick(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm1.loginClick(Sender: TObject);
begin
if u=edit1.Text and p=edit2.Text //问题行
then
form2.Show;
end;
end. 展开
提示错误,sUser是string类型的
源代码如下:
var
Form1: TForm1;
implementation
uses inifiles, Unit2;
var sUser,sPwd,u,p:string;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Conini:TiniFile;
begin
Conini:=TiniFile.Create('c:\my.ini');
//写
Conini.WriteString('Parameters','user','cai');
Conini.WriteString('Parameters','password','my');
//读
Conini.WriteString('Parameters','user','cai');
Conini.WriteString('Parameters','password','my');
sUser:=Conini.ReadString('Parameters','user','');
sPwd:=Conini.ReadString('Parameters','password','');
Conini.Free;
u:=sUser;
p:=sPwd;
end;
procedure TForm1.exitClick(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm1.loginClick(Sender: TObject);
begin
if u=edit1.Text and p=edit2.Text //问题行
then
form2.Show;
end;
end. 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询