I’m making a social media app and now I’m creating the textbox where the user writes the image description.
With the following blocks, I detect when the users enters a linebreak or not and, depending on this, I add 5 or 1 to the character indicator label. (because I want every linebreak count as 5 characters).
Now I have a problem: When the users deletes one character, the count goes up… My question is: How can I detect when the user deletes one character and evite the counter going up?
Ok,You need to have initialize a new var named OldLength…As you will use it later…Then create an if then statement : if OldLength > Textbox1.length than add 1 to the length var…Else subtract on of the length var and do the same when you want to add 5 ( if line break detected )…
Last important thing…At the end of the OnTextChanged event : set the OldLength var to TextBox1.length…So it get updated every time…That’s it