在program 中我有这样的代码:begin
Application.Initialize;
try
frmload:=Tfrmload.Create(nil);
finally
if frmload.ShowModal=mrcancel then
Halt
else
begin
Application.Title := '订单信息管理系统';
Application.CreateForm(Tcusdelform, cusdelform);
Application.CreateForm(Tddsearchform, ddsearchform);
Application.CreateForm(TPrinterForm, PrinterForm);
Application.Run;
end;
end;在frmload窗体中有
确定按钮
BitBtn1.Kind:=bkOK;BitBtn1.ModalResult:=mrOk
取消按钮
BitBtn2.Kind:=bkCancel;BitBtn2.ModalResult:=mrCancel
问题是确定按钮按一下都能进入主窗体.这样用户用也用不着验证了.
如何做才能验证了在进入主窗体.希望各位把代码写下来.
Application.Initialize;
try
frmload:=Tfrmload.Create(nil);
finally
if frmload.ShowModal=mrcancel then
Halt
else
begin
Application.Title := '订单信息管理系统';
Application.CreateForm(Tcusdelform, cusdelform);
Application.CreateForm(Tddsearchform, ddsearchform);
Application.CreateForm(TPrinterForm, PrinterForm);
Application.Run;
end;
end;在frmload窗体中有
确定按钮
BitBtn1.Kind:=bkOK;BitBtn1.ModalResult:=mrOk
取消按钮
BitBtn2.Kind:=bkCancel;BitBtn2.ModalResult:=mrCancel
问题是确定按钮按一下都能进入主窗体.这样用户用也用不着验证了.
如何做才能验证了在进入主窗体.希望各位把代码写下来.
begin
end;
这里怎样写?
Application.Initialize;
application.createform('省略')
application.createform(Tfrm_denglu,frm_denglu);
if frm_denglu.showmodal=1 then
begin
frm_denglu.Free;
Application.Run;
end
else
begin
Application.Terminate;
Application.Run;
end;
end
else
begin
Frm_system_splash.Close;
Application.Terminate;
Application.Run;
end
end
去跟数据库里的作比较,
try
frmload:=Tfrmload.Create(nil);
finally
if frmload.ShowModal=mrOK then
begin
Application.Title := '订单信息管理系统';
Application.CreateForm(Tcusdelform, cusdelform);
Application.CreateForm(Tddsearchform, ddsearchform);
Application.CreateForm(TPrinterForm, PrinterForm);
Application.Run;
end
begin
if 验证用户合法 then
modalresult:=mrok
else
messagedlg()//验证失败
end;
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
Unit3 in 'Unit3.pas' {Form3};{$R *.res}begin
Application.Initialize;
try
form2:=Tform2.Create(application);
form2.ShowModal ;
finally
if form2.Button1.ModalResult =1 then
Halt
else
begin Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm3, Form3);
Application.CreateForm(TForm2, Form2);
application.Run;
end;
end;
end.procedure TForm2.Button1Click(Sender: TObject);
begin
//在此之前天加数据验证
self.ModalResult :=mrOk;end;procedure TForm2.Button2Click(Sender: TObject);
begin self.Button1.ModalResult:=mrcancel;
exit;
end;end.
procedure Tloginform.Button1Click(Sender: TObject);begin
user:=combobox1.text;
pass:=edit1.text;
results:=ADOtable1.Lookup('username',ComboBox1.text,'password');{检索数据库中对应用户名的密码项}
if results=edit1.Text
then
begin
i:=true;
close;
form1.Show;
form1.StatusBar1.Panels[1].Text:=combobox1.text;
if combobox1.Text='操作员' then
begin
manageform.Button1.Enabled:=false;
power:=true;
end;
end
else
showmessage('密码不正确,请再输一次');
end;procedure Tloginform.Button2Click(Sender: TObject);
begin
close;
application.Terminate ;
end;