AHilberink Active Member Licensed User Longtime User May 8, 2014 #1 Hi, How do I use: Dim Text As String * 6 I want to use EditText with fixed number of characters. Is this possible or do I have to make a check myself? Best regards, André
Hi, How do I use: Dim Text As String * 6 I want to use EditText with fixed number of characters. Is this possible or do I have to make a check myself? Best regards, André
mangojack Expert Licensed User Longtime User May 8, 2014 #2 there is no property to set maximum characters in EditText .. you will have to manage input yourself. B4X: Sub EditText1_TextChanged (Old As String, New As String) If New > 6 Then EditText1.Text = Old End Sub Last edited: May 8, 2014 Upvote 0
there is no property to set maximum characters in EditText .. you will have to manage input yourself. B4X: Sub EditText1_TextChanged (Old As String, New As String) If New > 6 Then EditText1.Text = Old End Sub
M Mahares Expert Licensed User Longtime User May 8, 2014 #3 I think this line: B4X: If New > 6 Then EditText1.Text = Old shoud be: B4X: If New.Length > 6 Then EditText1.Text = Old Upvote 0
I think this line: B4X: If New > 6 Then EditText1.Text = Old shoud be: B4X: If New.Length > 6 Then EditText1.Text = Old
Erel B4X founder Staff member Licensed User Longtime User May 8, 2014 #4 Actually I think that it should be: B4X: If New.Length > 6 Then EditText1.Text = New.Substring(0, 6) Otherwise your code will not handle clipboard pastes correctly. Upvote 0
Actually I think that it should be: B4X: If New.Length > 6 Then EditText1.Text = New.Substring(0, 6) Otherwise your code will not handle clipboard pastes correctly.
AHilberink Active Member Licensed User Longtime User May 8, 2014 #5 Thanks for all help. It works fine now. But: B4X: If New.Length > 6 Then EditText1.Text = New.Substring(0, 6) Had to be B4X: If New.Length > 6 Then EditText1.Text = New.Substring2(0, 6) André Upvote 0
Thanks for all help. It works fine now. But: B4X: If New.Length > 6 Then EditText1.Text = New.Substring(0, 6) Had to be B4X: If New.Length > 6 Then EditText1.Text = New.Substring2(0, 6) André
mangojack Expert Licensed User Longtime User May 9, 2014 #6 apologies .. I did copy the code from an old post by Erel.. I did not dream I would have to audit it for errors !! Upvote 0
apologies .. I did copy the code from an old post by Erel.. I did not dream I would have to audit it for errors !!