How would i only allow integers to be typed into the TEdit and then have them used say for an inventory number.
Printable View
How would i only allow integers to be typed into the TEdit and then have them used say for an inventory number.
StrToIntDef(TEditBox.Text, DefaultValueIfUserEntersCrap);
How would that go in and where for Tedit
Simba Code:Edit3 := TEdit.Create(FrmDesign);
Edit3.Parent := FrmDesign;
Edit3.Top := 350;
Edit3.Left := 75;
Edit3.Width := 100;
Edit3.Height := 27;
all i want this to do isbe able to change a global variable known as
InvNumber: Integer;
ill assume you learnt this from tutorial and you have this procedure
Simba Code:Procedure ButtonClick(Sender: TObject);
Begin
frmDesign.ModalResult:= mrOk;
InvNumber:=StrToInt(Edit3.text);//you need to convert the value entered from a string
End;
that should work
Thanks.
would cause an error
BankPin Invalid Int value "981c"
you could make a check for this.
But really tho your not going to enter a letter to a number only field like bank pin without you noticing.