?
Solved

i want to show a login frame before the main form

Posted on 2004-04-30
7
Medium Priority
?
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 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