i have problem to allow enter only from 1 to 65535 bicouse
example if enter 10000,2000 is ok but enter 99 not.
hire 1 example (not working)
If somthing.Text > '65535 'then
ShowMessage(' you enter biger Number from 65535');
Exit;
hire 2 example (not working)
var
result : Integer;
string1: String;
string2: String;
begin
string1:='65535';
string2:= somthing.Text;
result := AnsiCompareStr(string1, string2);
if result < 0 then ShowMessage(string1+' < '+string2);
please help haw to solve this.
Thanks.
[DELPHI]
1. Convert your string to a number and test that.
2. create the following function and pass the string as
IF Between(Atextbox.Text,1,65535)
THEN MessageDlg('Thats OK',MtInformation,[MbOK],0)
ELSE MessageDlg('Bad Number',MtInformation,[MbOK],0);
You could also vary the Value by type and overload this to do any numbers
FUNCTION Between(Value : String;Low,High : LongInt) : BOOLEAN;
VAR
N : Integer;
Begin
TRY
N := StrtoInt(Value);
RESULT := ((N >= Low) AND (N <= High));
EXCEPT ON EConvertError DO
RESULT := FALSE;
End;
End;