M mtechteam Member Licensed User Longtime User Nov 20, 2023 #1 I am attempting to limit the number of characters to input to 10 characters. I am using the following code which works fine on B4a, but not B4i: Code: Copy Public Sub txtOrgID_TextChanged(Old As String, New As String) If New.Length > 10 Then txtOrgID.Text = Old End If End Sub If I show in a log file the value of txtOrgID.Text, it has not changed yet and matches the Old value, and the New Value is shown on the phone regardless of whether the size exceed 10 characters or not.
I am attempting to limit the number of characters to input to 10 characters. I am using the following code which works fine on B4a, but not B4i: Code: Copy Public Sub txtOrgID_TextChanged(Old As String, New As String) If New.Length > 10 Then txtOrgID.Text = Old End If End Sub If I show in a log file the value of txtOrgID.Text, it has not changed yet and matches the Old value, and the New Value is shown on the phone regardless of whether the size exceed 10 characters or not.
Alexander Stolte Expert Licensed User Longtime User Nov 20, 2023 #2 Did you test it on a simulator or on a real device? Upvote 0
Alexander Stolte Expert Licensed User Longtime User Nov 20, 2023 #4 put a sleep(0) before you read the .Text Property Upvote 0 Solution
Alexander Stolte Expert Licensed User Longtime User Nov 20, 2023 #5 But without more code its hard to say, whether this is the error. Upvote 0
M mtechteam Member Licensed User Longtime User Nov 20, 2023 #6 Perfect. Inserting the sleep(0) fixes the problem and resets the value back to the Old string Upvote 0