mierlp Posted June 28, 2013 Share Posted June 28, 2013 Hi, I have a UniDBMemo on a form where the user may enter max 80 characters, I use the code below to display the amount of remaining characters with the UniDBMemoChange event. TextLen := 100-Length(StringReplace(StringReplace(UniDBMemo_Motivation.Text, #10, '', [rfReplaceAll]), #13, '', [rfReplaceAll])); UniLabel_Count.Text:=intToStr(Textlen); But how to prevent the user entering more than 80 characters ? Regards Peter Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2013 Share Posted June 29, 2013 Hi mierlp.Try this:Add the code in UniDBMemo1.ClientEvents.ExtEvents function OnChange (sender, newValue, oldValue) { if (sender.getValue().length > 80) { sender.setValue(sender.getValue().slice(0, 80)); } } This is one of the solutionsSincerely. 2 Quote Link to comment Share on other sites More sharing options...
mierlp Posted June 29, 2013 Author Share Posted June 29, 2013 Thanks...this works great Quote Link to comment Share on other sites More sharing options...
mmurgas Posted July 10, 2013 Share Posted July 10, 2013 thanks this helped me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.