How can I detect when a user deletes a character on a textbox?

Hi!
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).

rec3

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?

Thank you very much for your answers!

1 Like

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 :+1:

1 Like

Looks good! I’m going to test it now

1 Like

I made it a little bit different but it works.
Thank you very much for your help!
recx4

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.