Solved

How to get user input

Posted on 1998-07-08
2
215 Views
Last Modified: 2010-04-04
I want to use inputbox to get user information
how can i ?
i´m using Delphi 3.02
0
Comment
Question by:vis
2 Comments
 
LVL 1

Accepted Solution

by:
Marcius earned 30 total points
ID: 1357304
function InputBox(const ACaption, APrompt, ADefault: string): string;

Example:

MyUserDate := InputBox('Login To Server','Username: ','');

This will prompt the user and allow them to enter some data. Once they press the OK button, the function will return to the calling program and your variable will contain the data.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1357305
or use InputQuery, From Delphi Help file:

This example uses a button and a label on the form. When the user clicks the button, the input box displays. If the user chooses OK, the string that appears in the edit box of the dialog box displays as the caption of the label on the form. If the user chooses Cancel, the dialog box closes and the caption of the label remains unchanged.

procedure TForm1.Button1Click(Sender: TObject);

var
  NewString: string;
  ClickedOK: Boolean;
begin
  NewString := 'Default String';
  Label1.Caption := NewString;
  ClickedOK := InputQuery('Input Box', 'Prompt', NewString);
  if ClickedOK then                 { NewString contains new input string }
    Label1.Caption := 'The new string is ''' + NewString + '''';
end;
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…

803 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