现有form1,form2窗口,form1为验证窗口,form2为验证后进入的窗口,现在问题是:在通过form1验证后,form1窗口可以消失,或者关闭,或者被取代,只要不显示就行了,只留一个form2就行了。请指教!

解决方案 »

  1.   

    老大,看看这个,你改一下就可以了  Application.Initialize;
      Application.CreateForm(TF_main, F_main);
      Application.CreateForm(TF_login, F_login);
      f_login.ShowModal;//主要地方
      Application.Run;验证地方
    procedure TF_login.suiButton1Click(Sender: TObject);
    var adologin:TADODataSet;
    begin if (suiComboBox1.Text='') or (suiEdit1.Text='') then
     begin
     application.MessageBox('用户名或密码不能为空!,请查证!','提示',64);
     exit
     end;
     adologin:=TADODataSet.Create(application);
     adologin.ConnectionString:=' Provider=SQLOLEDB.1;'+'Persist Security Info=False;User ID='+GetRegInfo(3)+';Password='+GetRegInfo(4)+';'+
                      'Initial Catalog='+GetRegInfo(2)+';Data Source='+GetRegInfo(1);
     adologin.CommandText:='select * from PassView where 用户名='''+trim(suiComboBox1.Text)+''''+' and '+'密码='+suiedit1.Text;
      adologin.Open;
      if adologin.RecordCount<>0 then
      begin
      username:=adologin.FieldValues['用户名'];
      power:=adologin.FieldValues['权限'];  adologin.Free;
        f_main.show;
      f_login.Hide;
      end else//密码错误处理
      begin
       adologin.Free;
       application.MessageBox('用户名和密码有误!请查证后再输!','提示',64);
       suiedit1.Text:='';
       exit;
      end;//end else
    end;
      

  2.   

    zdq801104(我很笨,但是我不傻!) ( 
    我还没有试,不知道行不行,初学!