hi How to allow enter only 5 char in Tedit without using tmask?
Thanks.
especta
0
Newbie Poster
Recommended Answers
Jump to Posthi How to allow enter only 5 char in Tedit without using tmask?
Thanks.procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); var T: string; begin T := Edit1.Text; if (Length(T)>4) and (Key<>#8) then Key := #0; end;
Key=#8 allows to be used BACKSPACE
Jump to Postit would be also good to check the length in case it is more than 5 each time, because if you paste some text (using shift-ins), it won't be filtered
All 6 Replies
finalist
1
Junior Poster in Training
especta
commented:
Thank you its help my very much
+1
crystalbit
0
Newbie Poster
finalist
1
Junior Poster in Training
finalist
1
Junior Poster in Training
especta
0
Newbie Poster
crystalbit
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.