Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InputBox - cant get it to work 1

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
What I need is for the user to enter a numerical value between 2 and 36 (this is to set a server for a game, for which the minimum number of players is 2 and the maximum is 36, the reason im making this application is because we want to use it for league play and nowadays you need to be offering something for people to join your league).

What I came across was this:

function InputBox(const ACaption, APrompt: WideString; ADefault: Integer; Min: Integer = Low(Integer); Max: Integer = High(Integer); Increment: Integer = 1): Integer; overload;

(Excerpt from the Delphi 7 Enterprise helpfile)

Code:
procedure TGRManager.btSetForTAGMatchesClick(Sender: TObject);
var NumPlayers: integer;
begin

NumPlayers := InputBox('Enter the number of players','Enter the number of players that will be joining the server',1,2,36,1);

ShowMessage('Number of players selected: ' + IntToStr(NumPlayers));
end;

It keeps giving me the error String and Integer not compatible.

Any help is appreciated!

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Hi,

Have you got the QDialogs unit in the Uses clause?


There are two ways to write error-free programs; only the third one works.
 
Man, I never thought of that, it says "Dialogs or QDialogs" at the top of the help and as I had Dialods in my
uses clause I figured I was good to go in that respect. But thanx for straightening me out :D

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
No problem.

[2thumbsup]

There are two ways to write error-free programs; only the third one works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top