Solved

i want to show a login frame before the main form

Posted on 2004-04-30
7
149 Views
Last Modified: 2010-04-05
hello
i need to show a frame on starting the prog  before the main form
to get the username and the password and if correct it show the other form and close the first
sure also get data from the first to the second.
thx
0
Comment
Question by:mis82
  • 2
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 250 total points
ID: 10960230

   create frmLogin like the example below
   ---------------------------------------------------------------------------

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TfrmLogin = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
    class procedure GetLoginInfo (var Username, password : String);
  end;

var
  frmLogin: TfrmLogin;

implementation

{$R *.DFM}

{ TfrmLogin }

class procedure TfrmLogin.GetLoginInfo(var Username, password: String);
var
  tmp_form : TfrmLogin;
begin
  tmp_Form := TfrmLogin.Create(Application);
  with tmp_Form do
    begin
      if ShowModal = mrOK then
        begin
          UserName := Edit1.Text;
          Password := Edit2.text;
        end;
    end;
end;

end.


   and MainForm as shown :
   ------------------------------------------------------------
   unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    u, p : String;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses Unit2;

procedure TForm1.FormCreate(Sender: TObject);
begin
  TfrmLogin.GetLoginInfo(u, p);
end;

end.
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 10961091
.. or call in from the project source file, just before the Application.Exeucte()
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10967162

  andrewjb, you mean Application.Run :))
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 10984973
Knew it was something like that :-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question