zoukankan      html  css  js  c++  java
  • 重复登录窗体的实现(非原创)

    之前自己一直是在loginform窗体中写判断语句,用户名及密码有错的话,不能重新显示该窗体。

    参考其他网友的做法,在主窗体的oncreate事件中动态创建loginform.并在Mainform中的oncreate事件来判断登录的正确性。可以重复调用loginform.showmodal事件。

    procedure TForm1.check_psw(times: integer);
    begin
      inc(times);
      
    if (loginfrm.ShowModal=mrok) then
        
    begin
          
    if  (times<4then
            
    begin
                 
    if (loginfrm.Edit1.text<>'Edit1'then  //此处省略了从数据库中查询用户名及密码的过程
                    
    begin
                      application.MessageBox(
    '没有该用户','Error',0);
                      check_psw(times);
                    
    end
                    
    else
                       
    if (loginfrm.Edit2.text<>'12'then
                          
    begin
                            application.MessageBox(
    '密码错误','Error',0);
                            check_psw(times);
                          
    end
                       
    else
                         loginfrm.Free;
              
    end
          
    else
             
    begin
                application.MessageBox(
    'over 3 times','error',0);
                application.Terminate;
                loginfrm.Free;
              
    end;
         
    end
           
    else
               
    begin
                application.MessageBox(
    '退出程序','info',0);
                application.Terminate;
                loginfrm.Free;
              
    end;
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      loginfrm:
    =Tloginform.Create(nil);
      check_psw(
    0);
    end;

     以上想法参照网友,非自己原创。但找不到出处了。个别处理自己作出了调整!

  • 相关阅读:
    【一致性检验指标】Kappa(cappa)系数
    仅需4步,轻松升级K3s集群!
    使用Kubernetes、K3s和Traefik2进行本地开发
    超强教程!在树莓派上构建多节点K8S集群!
    使用容器化块存储OpenEBS在K3s中实现持久化存储
    仅需60秒,使用k3sup快速部署高可用K3s集群
    在本地运行Kubernetes的3种主流方式
    为什么Kubernetes在边缘计算中如此关键?
    这4件事,让你了解边缘计算的真实面貌
    极简教程!教你快速将K3s与Cloud Controller集成
  • 原文地址:https://www.cnblogs.com/samsonleung/p/1247179.html
Copyright © 2011-2022 走看看